Fix dependency loop

This commit is contained in:
Tibo De Peuter 2022-12-22 13:31:46 +01:00
parent b7278d6afc
commit f529fc5237
25 changed files with 251 additions and 199 deletions

View file

@ -4,12 +4,23 @@ module RPGEngine.Input
( handleAllInput
) where
import RPGEngine.Input.Core
import RPGEngine.Data
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 )
------------------------------ Exported ------------------------------
-- Handle all input of all states of the game.
handleAllInput :: InputHandler Game
handleAllInput ev g@Game{ state = state } = handleInput ev g
where handleInput = inputHandler $ base state
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