diff --git a/ghcidOutput b/ghcidOutput index 4bba621df..d30cade76 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 19:45:49) +All good (594 modules, at 19:52:21) diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 152368811..ca3854b94 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -32,7 +32,7 @@ import LensHelp import SDL updateUseInputInGame :: Universe -> Universe -updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of +updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . hudElement of DisplayCarte -> over uvWorld updatePressedButtonsCarte u DisplayInventory{_subInventory = si} -> case si of DisplayTerminal tmid @@ -88,6 +88,20 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of & ciSelection .~ msel' & ciFilter .~ filts' +updateFunctionKeys :: Universe -> Universe +updateFunctionKeys u = M.foldlWithKey' updateFunctionKey u + (u ^. uvWorld . input . pressedKeys) + +updateFunctionKey :: Universe -> Scancode -> PressType -> Universe +updateFunctionKey uv sc InitialPress = case sc of + ScancodeF1 -> useNormalCamera uv + ScancodeF2 -> pauseAndFloatCam uv + ScancodeF5 -> doQuicksave uv + ScancodeF9 -> doQuickload uv + ScancodeEscape -> pauseGame uv + _ -> uv +updateFunctionKey uv _ _ = uv + updateCombineInvClick :: Maybe (Int, Int) -> IM.IntMap (SelectionSection CombinableItem) -> @@ -161,11 +175,6 @@ updateKeyInGame uv sc pt = case pt of updateInitialPressInGame :: Universe -> Scancode -> Universe updateInitialPressInGame uv sc = case sc of - ScancodeF1 -> useNormalCamera uv - ScancodeF2 -> pauseAndFloatCam uv - ScancodeF5 -> doQuicksave uv - ScancodeF9 -> doQuickload uv - ScancodeEscape -> pauseGame uv ScancodeSpace -> over uvWorld spaceAction uv ScancodeP -> pauseGame uv ScancodeF -> over uvWorld youDropItem uv