tracer/src/StateMachine.hs

34 lines
621 B
Haskell
Raw Normal View History

2018-02-07 00:18:16 +00:00
{-# LANGUAGE MultiParamTypeClasses #-}
module StateMachine where
import Affection
import Types
import Test
2018-02-07 00:18:16 +00:00
instance StateMachine State UserData where
smLoad Menu = loadMap
2018-02-07 00:18:16 +00:00
smUpdate Menu = updateMap
2018-02-07 00:18:16 +00:00
smDraw Menu = drawMap
2018-02-07 00:18:16 +00:00
smEvent _ evs = do
Subsystems w m <- subsystems <$> getAffection
_ <- consumeSDLEvents w =<< consumeSDLEvents m evs
return ()
smClean _ = do
ud <- getAffection
let Subsystems w m = subsystems ud
toClean = uuid ud
mapM_ (\u -> do
partUnSubscribe w u
partUnSubscribe m u
) toClean
putAffection ud
{ uuid = []
}