SoccerFun 0.1.1 → 0.1.2
raw patch · 3 files changed
+9/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- SoccerFun.cabal +1/−1
- SoccerFun/MatchControl.hs +2/−0
- SoccerFun/UI/GL.hs +6/−2
SoccerFun.cabal view
@@ -1,5 +1,5 @@ Name: SoccerFun-Version: 0.1.1+Version: 0.1.2 Copyright: (c) 2010, Jan Rochel License: BSD3 License-File: LICENSE
SoccerFun/MatchControl.hs view
@@ -33,6 +33,8 @@ type Score = (NrOfGoals,NrOfGoals) -- ^ (goals by Team1, goals by Team2) type NrOfGoals = Int -- ^ (zero) <= nr of goals +lookupPlayer ∷ PlayerID → Match → Maybe Player+lookupPlayer pid Match {team1 = t1, team2 = t2} = find ((==) pid ∘ playerID) (t1 ⧺ t2) setMatchStart ∷ Team → Team → Field → Referee → PlayingTime → StdGen → Match setMatchStart fstTeam sndTeam field referee time rs
SoccerFun/UI/GL.hs view
@@ -6,6 +6,7 @@ import Data.IORef import Control.Monad import Unsafe.Coerce+import Data.Maybe --import Control.DeepSeq import SoccerFun.MatchControl@@ -89,7 +90,7 @@ GL.lineWidth $= 3 renderField field GL.lineWidth $= 2- renderBall ball+ renderBall ball m colorRGB (1,0,0) -- red mapM_ renderPlayer t1 colorRGB (0,0,1) -- blue@@ -131,7 +132,10 @@ GL.translate $ vector2 pos GL.renderPrimitive GL.Polygon (circle goalPoleWidth 7) - renderBall (Free Ball {ballPos = p}) = do+ renderBall ball match = do+ let p = case ball of+ GainedBy pid → toPosition3D $ pos $ fromJust $ lookupPlayer pid match+ Free Ball {ballPos = p} → p colorRGB (1,1,1) -- white drawAt3D p $ GL.renderPrimitive GL.Polygon (circle radiusBall 7)