tracer/src/StateMachine.hs
2019-03-28 20:59:31 +01:00

42 lines
1,017 B
Haskell

{-# LANGUAGE MultiParamTypeClasses #-}
module StateMachine where
import Affection
import Types
import Load
import Menu.Connect
import Menu.Adjust
import MainGame.WorldMap
import MainGame.MindMap
import Util
instance StateMachine State UserData where
smLoad Load = loadLoad
smLoad (Menu Connect) = loadMenu
smLoad (Menu (Adjust a c)) = loadAdjust a c loadMenu
smLoad (Main _) = loadMap
smUpdate Load = updateLoad
smUpdate (Menu Connect) = updateMenu
smUpdate (Menu (Adjust _ _)) = const (return ())
smUpdate (Main WorldMap) = updateMap
smUpdate (Main MindMap) = updateMind
smDraw Load = drawLoad
smDraw (Menu Connect) = drawMenu
smDraw (Menu (Adjust _ _)) = drawMenu >> drawAdjust
smDraw (Main WorldMap) = drawMap
smDraw (Main MindMap) = drawMind
smEvent _ evs = do
Subsystems w m k j _ <- subsystems <$> getAffection
_ <- consumeSDLEvents j =<<
consumeSDLEvents k =<<
consumeSDLEvents w =<<
consumeSDLEvents m evs
return ()
smClean _ = fullClean