Work on saving/loading concurrently
This commit is contained in:
@@ -38,7 +38,7 @@ import SDL
|
||||
handleTextInput :: T.Text -> Universe -> Universe
|
||||
handleTextInput text u =
|
||||
u
|
||||
& menuLayers . ix 0 . scInput %~ updateText
|
||||
& uvScreenLayers . ix 0 . scInput %~ updateText
|
||||
& updateTerminalText
|
||||
where
|
||||
updateTerminalText = case u ^? uvWorld . cWorld . hud . hudElement . subInventory of
|
||||
@@ -85,12 +85,12 @@ handlePressedKey _ scode u = case scode of
|
||||
ScancodeF5 -> return . Just $ doQuicksave u
|
||||
ScancodeF9 -> return . Just $ loadSaveSlot QuicksaveSlot u
|
||||
ScancodeSemicolon -> return . Just $ gotoTerminal u
|
||||
_ | null (_menuLayers u) -> case u ^? uvWorld . cWorld . hud . hudElement . subInventory of
|
||||
_ | null (_uvScreenLayers u) -> case u ^? uvWorld . cWorld . hud . hudElement . subInventory of
|
||||
Just (DisplayTerminal tmid)
|
||||
| inTermFocus (_uvWorld u) ->
|
||||
return $ uvWorld (Just . handlePressedKeyTerminal tmid scode) u
|
||||
_ -> return $ (Just . handlePressedKeyInGame scode) u
|
||||
_ -> handlePressedKeyInMenu (head $ _menuLayers u) scode u
|
||||
_ -> handlePressedKeyInMenu (head $ _uvScreenLayers u) scode u
|
||||
|
||||
handlePressedKeyInGame :: Scancode -> Universe -> Universe
|
||||
handlePressedKeyInGame scode uv = case scode of
|
||||
@@ -136,9 +136,9 @@ toggleInspectInv he = case he of
|
||||
_ -> DisplayInventory InspectInventory
|
||||
|
||||
gotoTerminal :: Universe -> Universe
|
||||
gotoTerminal w = case _menuLayers w of
|
||||
gotoTerminal w = case _uvScreenLayers w of
|
||||
(InputScreen{} : _) -> w
|
||||
_ -> w & menuLayers .:~ InputScreen T.empty "Enter command"
|
||||
_ -> w & uvScreenLayers .:~ InputScreen T.empty "Enter command"
|
||||
|
||||
spaceAction :: World -> World
|
||||
spaceAction w = case _hudElement $ _hud (_cWorld w) of
|
||||
@@ -155,7 +155,7 @@ spaceAction w = case _hudElement $ _hud (_cWorld w) of
|
||||
-- updateTopCloseObject i w' = w' & closeObjects %~ ( Right (_buttons w' IM.! i) : ) . tail
|
||||
|
||||
pauseGame :: Universe -> Universe
|
||||
pauseGame = menuLayers .~ [pauseMenu]
|
||||
pauseGame = uvScreenLayers .~ [pauseMenu]
|
||||
|
||||
toggleMap :: World -> World
|
||||
toggleMap w = case _hudElement $ _hud (_cWorld w) of
|
||||
|
||||
Reference in New Issue
Block a user