small platformer game
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
948 B

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
module StateMachine where
import Affection
import Control.Monad (void)
-- internal imports
import Types
import State.Loading
import State.MainGame
instance StateMachine GameData State where
smLoad Loading = initLoad
smLoad (MainGame Test) = mainGameLoad
smLoad x = error ("State load not yet implemented: " <> show x)
smUpdate Loading = initLoadUpdate
smUpdate (MainGame Test) = mainGameUpdate
smUpdate x = error ("State update not yet implemented: " <> show x)
smDraw Loading = initLoadDraw
smDraw (MainGame Test) = mainGameDraw
smDraw x = error ("State draw not yet implemented: " <> show x)
smEvent _ gd evs = do
let Subsystems w m k _ = gameSubsystems gd
void . (consumeSDLEvents k) =<<
consumeSDLEvents m =<<
consumeSDLEvents w evs
smClean x = error ("State clean not yet implemented: " <> show x)