module Input ( -- Handle all input for RPG-Engine handleAllInput ) where import Game import State import InputHandling import Graphics.Gloss.Interface.IO.Game ---------------------------------------------------------------------- handleAllInput :: InputHandler Game handleAllInput ev g@Game{ state = Playing } = handlePlayInputs ev g handleAllInput ev g = handleAnyKey setNextState ev g handlePlayInputs :: InputHandler Game handlePlayInputs = composeInputHandlers [ handleKey (Char 'p') (\game -> game{ state = Pause }) ] -- Go to the next stage of the Game setNextState :: Game -> Game setNextState game = game{ state = newState } where newState = nextState $ state game