31 lines
620 B
Haskell
31 lines
620 B
Haskell
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
|
|
module StateMachine where
|
|
|
|
import Affection
|
|
|
|
import Types
|
|
|
|
instance StateMachine State UserData where
|
|
smLoad Menu = return ()
|
|
|
|
smUpdate Menu = const $ return ()
|
|
|
|
smDraw Menu = return ()
|
|
|
|
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 = []
|
|
}
|