Allow use of esc and function keys when in terminal/other subinventories

This commit is contained in:
2024-11-07 19:53:53 +00:00
parent 216d55865f
commit b48e949577
2 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 19:45:49) All good (594 modules, at 19:52:21)
+15 -6
View File
@@ -32,7 +32,7 @@ import LensHelp
import SDL import SDL
updateUseInputInGame :: Universe -> Universe 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 DisplayCarte -> over uvWorld updatePressedButtonsCarte u
DisplayInventory{_subInventory = si} -> case si of DisplayInventory{_subInventory = si} -> case si of
DisplayTerminal tmid DisplayTerminal tmid
@@ -88,6 +88,20 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
& ciSelection .~ msel' & ciSelection .~ msel'
& ciFilter .~ filts' & 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 :: updateCombineInvClick ::
Maybe (Int, Int) -> Maybe (Int, Int) ->
IM.IntMap (SelectionSection CombinableItem) -> IM.IntMap (SelectionSection CombinableItem) ->
@@ -161,11 +175,6 @@ updateKeyInGame uv sc pt = case pt of
updateInitialPressInGame :: Universe -> Scancode -> Universe updateInitialPressInGame :: Universe -> Scancode -> Universe
updateInitialPressInGame uv sc = case sc of 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 ScancodeSpace -> over uvWorld spaceAction uv
ScancodeP -> pauseGame uv ScancodeP -> pauseGame uv
ScancodeF -> over uvWorld youDropItem uv ScancodeF -> over uvWorld youDropItem uv