29 lines
No EOL
1.4 KiB
Haskell
29 lines
No EOL
1.4 KiB
Haskell
-- Implementations for each state can be found in their respective
|
|
-- submodules.
|
|
module RPGEngine.Input
|
|
( handleAllInput
|
|
) where
|
|
|
|
import RPGEngine.Input.Core ( InputHandler, composeInputHandlers, handleAnyKey )
|
|
|
|
import RPGEngine.Data ( Game(..), State(..) )
|
|
import RPGEngine.Input.Menu ( handleInputMenu )
|
|
import RPGEngine.Input.LevelSelection (handleInputLevelSelection)
|
|
import RPGEngine.Input.Playing ( handleInputPlaying )
|
|
import RPGEngine.Input.Paused ( handleInputPaused )
|
|
import RPGEngine.Input.Win ( handleInputWin )
|
|
import RPGEngine.Input.Lose ( handleInputLose )
|
|
import RPGEngine.Input.ActionSelection (handleInputActionSelection)
|
|
|
|
------------------------------ Exported ------------------------------
|
|
|
|
-- Handle all input of all states of the game.
|
|
handleAllInput :: InputHandler Game
|
|
handleAllInput ev g@Game{ state = Menu } = handleInputMenu ev g
|
|
handleAllInput ev g@Game{ state = LevelSelection{} } = handleInputLevelSelection ev g
|
|
handleAllInput ev g@Game{ state = Playing{} } = handleInputPlaying ev g
|
|
handleAllInput ev g@Game{ state = Paused{} } = handleInputPaused ev g
|
|
handleAllInput ev g@Game{ state = Win } = handleInputWin ev g
|
|
handleAllInput ev g@Game{ state = Lose{} } = handleInputLose ev g
|
|
handleAllInput ev g@Game{ state = ActionSelection{}} = handleInputActionSelection ev g
|
|
handleAllInput ev g@Game{ state = Error _ } = handleAnyKey (\game -> game{ state = Menu}) ev g |