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 03:44:19 +00:00
|
|
|
class StateMachine a where
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | State load routine
|
2020-05-04 03:44:19 +00:00
|
|
|
smLoad :: a -> Affection ()
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | state update routine
|
2020-05-04 03:44:19 +00:00
|
|
|
smUpdate :: a -> Double -> Affection ()
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | State event handler routine
|
2020-05-04 03:44:19 +00:00
|
|
|
smEvent :: a -> [SDL.EventPayload] -> Affection ()
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | State draw routine
|
2020-05-04 03:44:19 +00:00
|
|
|
smDraw :: a -> Affection ()
|
2018-09-25 05:02:33 +00:00
|
|
|
-- | State clean routine
|
2020-05-04 03:44:19 +00:00
|
|
|
smClean :: a -> Affection ()
|