Moved source files to src directory
This commit is contained in:
parent
2bb8561836
commit
7327695ca3
14 changed files with 3 additions and 6 deletions
27
src/Player.hs
Normal file
27
src/Player.hs
Normal file
|
@ -0,0 +1,27 @@
|
|||
{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
|
||||
|
||||
module Player ( Player(..)
|
||||
, SomePlayer(..)
|
||||
) where
|
||||
|
||||
import Data.Fixed
|
||||
import Data.Typeable
|
||||
|
||||
import Game (Tank(..))
|
||||
import GLDriver (SomeEvent)
|
||||
|
||||
|
||||
class Player a where
|
||||
playerUpdate :: a -> Tank -> (a, Maybe Micro, Bool, Maybe Micro, Bool)
|
||||
handleEvent :: a -> SomeEvent -> a
|
||||
|
||||
handleEvent player _ = player
|
||||
|
||||
|
||||
data SomePlayer = forall a. Player a => SomePlayer a
|
||||
|
||||
instance Player SomePlayer where
|
||||
playerUpdate (SomePlayer player) tank =
|
||||
let (p, angle, move, aangle, shoot) = playerUpdate player tank
|
||||
in (SomePlayer p, angle, move, aangle, shoot)
|
||||
handleEvent (SomePlayer player) event = SomePlayer $ handleEvent player event
|
Reference in a new issue