affection/src/Affection/StateMachine.hs

21 lines
574 B
Haskell
Raw Permalink Normal View History

2017-03-05 15:39:37 +00:00
{-# LANGUAGE MultiParamTypeClasses #-}
module Affection.StateMachine where
import Affection.Types
import qualified SDL
2018-09-25 05:02:33 +00:00
-- | Typeclass for simple scaffolding of a state machine
2020-05-04 19:31:42 +00:00
class StateMachine us a where
2018-09-25 05:02:33 +00:00
-- | State load routine
2020-05-04 19:31:42 +00:00
smLoad :: a -> us -> Affection ()
2018-09-25 05:02:33 +00:00
-- | state update routine
2020-05-04 19:31:42 +00:00
smUpdate :: a -> us -> Double -> Affection ()
2018-09-25 05:02:33 +00:00
-- | State event handler routine
2020-05-04 19:31:42 +00:00
smEvent :: a -> us -> [SDL.EventPayload] -> Affection ()
2018-09-25 05:02:33 +00:00
-- | State draw routine
2020-05-04 19:31:42 +00:00
smDraw :: a -> us -> Affection ()
2018-09-25 05:02:33 +00:00
-- | State clean routine
2020-05-04 19:31:42 +00:00
smClean :: a -> us -> Affection ()