Cleanup
This commit is contained in:
+12
-12
@@ -64,14 +64,14 @@ handlePressedKey True ScancodeBackspace u
|
||||
| otherwise = return $ Just $ u & uvWorld . backspaceTimer -~ 1
|
||||
handlePressedKey True _ u = return $ Just u
|
||||
handlePressedKey _ scode u = case scode of
|
||||
ScancodeF5 -> return . Just $ doQuicksave u
|
||||
ScancodeF9 -> return . Just $ loadSaveSlot QuicksaveSlot u
|
||||
ScancodeSemicolon -> return . Just $ gotoTerminal u
|
||||
ScancodeF5 -> return . Just $ doQuicksave u
|
||||
ScancodeF9 -> return . Just $ loadSaveSlot QuicksaveSlot u
|
||||
ScancodeSemicolon -> return . Just $ gotoTerminal u
|
||||
_ | null (_menuLayers u) -> case u ^? uvWorld . hud . hudElement . subInventory of
|
||||
Just (DisplayTerminal tmid)
|
||||
| hasTerminalFocus (_uvWorld u) -> return $ uvWorld (handlePressedKeyTerminal tmid scode) u
|
||||
_ -> return $ uvWorld (Just . handlePressedKeyInGame scode) u
|
||||
_ -> handlePressedKeyInMenu (head $ _menuLayers u) scode u
|
||||
Just (DisplayTerminal tmid) | inTermFocus (_uvWorld u)
|
||||
-> return $ uvWorld (Just . handlePressedKeyTerminal tmid scode) u
|
||||
_ -> return $ uvWorld (Just . handlePressedKeyInGame scode) u
|
||||
_ -> handlePressedKeyInMenu (head $ _menuLayers u) scode u
|
||||
|
||||
handlePressedKeyInGame :: Scancode -> World -> World
|
||||
handlePressedKeyInGame scode w = case scode of
|
||||
@@ -88,14 +88,14 @@ handlePressedKeyInGame scode w = case scode of
|
||||
_ -> w
|
||||
|
||||
|
||||
handlePressedKeyTerminal :: Int -> Scancode -> World -> Maybe World
|
||||
handlePressedKeyTerminal :: Int -> Scancode -> World -> World
|
||||
handlePressedKeyTerminal tmid scode w = case scode of
|
||||
ScancodeEscape -> Just $ w & terminals . ix tmid . tmInput . tiFocus %~ const False
|
||||
ScancodeReturn -> Just $ w & doTerminalEffect (w ^?! terminals . ix tmid)
|
||||
ScancodeBackspace -> Just $ w
|
||||
ScancodeEscape -> w & terminals . ix tmid . tmInput . tiFocus %~ const False
|
||||
ScancodeReturn -> w & terminalReturnEffect (w ^?! terminals . ix tmid)
|
||||
ScancodeBackspace -> w
|
||||
& terminals . ix tmid . tmInput . tiText %~ doBackspace
|
||||
& backspaceTimer .~ 5
|
||||
_ -> Just w
|
||||
_ -> w
|
||||
where
|
||||
doBackspace t = case T.unsnoc t of
|
||||
Nothing -> t
|
||||
|
||||
Reference in New Issue
Block a user