SoccerFunGL 0.4.4 → 0.5
raw patch · 3 files changed
+41/−7 lines, 3 filesdep +processdep ~SoccerFun
Dependencies added: process
Dependency ranges changed: SoccerFun
Files
- SoccerFun/UI/GL/RunMatch.hs +12/−5
- SoccerFun/UI/GL/RunMatch/Template.hs +23/−0
- SoccerFunGL.cabal +6/−2
SoccerFun/UI/GL/RunMatch.hs view
@@ -2,22 +2,29 @@ -- | Usage: Hit /q/ to abort the match module Main where -import SoccerFun.UI.GL import Control.Monad import System.Exit import Prelude.Unicode import Data.Binary import SoccerFun.MatchGame import SoccerFun.Tape+import System.Cmd+import System.Environment+import Paths_SoccerFunGL main ∷ IO () main = do- (prog,args) ← initialise- let (t1,t2) = case args of+ prog ← getProgName+ args ← getArgs+ let (p1,p2) = case args of [t1,t2] → (t1,t2) notTwo → error $ unlines ["Run a match between two teams <Team1> and <Team2>", "Usage: " ⧺ prog ⧺ " <dir1> <dir2>", " where both arguments are paths to directories containing a team module."]- (t1name,t2name,match) ← dynSetupMatch t1 t2- playTape $ recordMatch match+ (loc1,name1) ← compileTeam p1+ (loc2,name2) ← compileTeam p2+ runMatch ← getDataFileName "SoccerFun/UI/GL/RunMatch/Template.hs"+ exitCode ← system $ "runhaskell -i" ⧺ loc1 ⧺ " -i" ⧺ loc2 ⧺ " -DTEAM1=" ⧺ name1 ⧺ " -DTEAM2=" ⧺ name2 ⧺ " " ⧺ runMatch+ when (exitCode ≢ ExitSuccess) (fail "Could merge teams, probably due to a type error.")+
+ SoccerFun/UI/GL/RunMatch/Template.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE UnicodeSyntax, CPP #-}+{-# OPTIONS_GHC -pgmP cpp #-}+-- | Usage: Hit /q/ to abort the match+module Main where++import SoccerFun.UI.GL+import Control.Monad+import System.Exit+import Prelude.Unicode+import Data.Binary+import SoccerFun.MatchGame+import SoccerFun.Tape+import qualified TEAM1.Team as Team1+import qualified TEAM2.Team as Team2++#define MKSTRING(x) #x+#define TOSTRING(x) MKSTRING(x)++main ∷ IO ()+main = do+ initialise+ match ← setupMatch Team1.team Team2.team+ playTape $ recordMatch match
SoccerFunGL.cabal view
@@ -1,5 +1,5 @@ Name: SoccerFunGL-Version: 0.4.4+Version: 0.5 Copyright: (c) 2010, Jan Rochel License: BSD3 License-File: LICENSE@@ -12,6 +12,7 @@ Description: This provides an 2D user interface for the SoccerFun framework implemented in OpenGL/GLUT. Category: Game, Education, AI Cabal-Version: >= 1.6+Data-Files: SoccerFun/UI/GL/RunMatch/Template.hs Library Extensions:@@ -23,9 +24,12 @@ binary >= 0.5 && < 0.6, GLUT >= 2.2 && < 2.3, OpenGL >= 2.4 && < 2.5,- SoccerFun >= 0.4.4 && < 0.5+ SoccerFun >= 0.5 && < 0.6,+ process >= 1.0 && < 1.1 Exposed-Modules: SoccerFun.UI.GL+ Other-Modules:+ Paths_SoccerFunGL Executable sfPlayTape Main-Is: SoccerFun/UI/GL/PlayTape.hs