haskelloids/src/StateMachine.hs

37 lines
596 B
Haskell
Raw Normal View History

2017-02-20 19:51:33 +00:00
{-# LANGUAGE MultiParamTypeClasses #-}
module StateMachine where
2017-12-16 10:55:30 +00:00
import Affection
2017-02-20 19:51:33 +00:00
import qualified SDL
import GEGL
import qualified Data.Map as M
import Data.Maybe (catMaybes)
import Control.Monad (foldM, when)
import System.Random (randomRIO)
import Types
import Commons
import InGame
2017-12-16 10:55:30 +00:00
import Menu
2017-02-20 19:51:33 +00:00
instance StateMachine State UserData where
2017-12-16 10:55:30 +00:00
smLoad Menu = loadMenu
2017-02-20 19:51:33 +00:00
smLoad InGame = loadGame
2017-12-16 10:55:30 +00:00
smUpdate Menu = updateMenu
2017-02-20 19:51:33 +00:00
smUpdate InGame sec = updateGame sec
2017-12-16 10:55:30 +00:00
smEvent Menu = handleMenuEvent
2017-02-20 19:51:33 +00:00
2017-12-16 10:55:30 +00:00
smEvent InGame = handleGameEvent
2017-02-20 19:51:33 +00:00
2017-12-16 10:55:30 +00:00
smDraw Menu = return ()
2017-02-20 19:51:33 +00:00
smDraw InGame = drawGame