Added Wiimote support
This commit is contained in:
parent
736ad91b32
commit
c0d2d54ea1
8 changed files with 76 additions and 31 deletions
|
@ -12,7 +12,7 @@ import GLDriver (SomeEvent)
|
|||
|
||||
|
||||
class Player a where
|
||||
playerUpdate :: a -> Tank -> (a, Maybe Micro, Bool, Maybe Micro, Bool)
|
||||
playerUpdate :: a -> Tank -> IO (a, Maybe Micro, Bool, Maybe Micro, Bool)
|
||||
handleEvent :: a -> SomeEvent -> a
|
||||
|
||||
handleEvent player _ = player
|
||||
|
@ -21,7 +21,7 @@ class Player a where
|
|||
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)
|
||||
playerUpdate (SomePlayer player) tank = do
|
||||
(p, angle, move, aangle, shoot) <- playerUpdate player tank
|
||||
return (SomePlayer p, angle, move, aangle, shoot)
|
||||
handleEvent (SomePlayer player) event = SomePlayer $ handleEvent player event
|
||||
|
|
Reference in a new issue