Another structure overhaul
This commit is contained in:
parent
3b0de65de1
commit
0720f3b719
14 changed files with 158 additions and 148 deletions
29
lib/RPGEngine/Data/State.hs
Normal file
29
lib/RPGEngine/Data/State.hs
Normal file
|
@ -0,0 +1,29 @@
|
|||
-- Describes the current state of the game,
|
||||
-- e.g. Main menu, game, pause, win or lose
|
||||
-- Allows to easily go to a next state and change rendering accordingly
|
||||
|
||||
module RPGEngine.Data.State
|
||||
( State(..)
|
||||
, defaultState
|
||||
|
||||
, nextState
|
||||
) where
|
||||
|
||||
import RPGEngine.Data.Types
|
||||
|
||||
----------------------------- Constants ------------------------------
|
||||
|
||||
-- Default state of the game, Menu
|
||||
defaultState :: State
|
||||
defaultState = Menu
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
-- Get the next state based on the current state
|
||||
nextState :: State -> State
|
||||
nextState Menu = Playing
|
||||
nextState Playing = Pause
|
||||
nextState Pause = Playing
|
||||
nextState _ = Menu
|
||||
|
||||
----------------------------------------------------------------------
|
Reference in a new issue