Start pushing updateUseInput into other update functions
This commit is contained in:
+11
-11
@@ -8,6 +8,8 @@ module Dodge.Update (updateUniverse) where
|
||||
|
||||
--import Dodge.InputFocus
|
||||
|
||||
import Dodge.Update.Input.InGame
|
||||
import Dodge.Update.Input.ScreenLayer
|
||||
import Dodge.Debug
|
||||
import Dodge.SmoothScroll
|
||||
import Color
|
||||
@@ -54,7 +56,6 @@ import Dodge.TmTm
|
||||
import Dodge.TractorBeam.Update
|
||||
import Dodge.Update.Camera
|
||||
import Dodge.Update.Cloud
|
||||
import Dodge.Update.Input
|
||||
import Dodge.Update.Scroll
|
||||
import Dodge.Update.WallDamage
|
||||
import Dodge.WallCreatureCollisions
|
||||
@@ -71,14 +72,8 @@ import StrictHelp
|
||||
updateUniverse :: Universe -> Universe
|
||||
updateUniverse u =
|
||||
updateUniverseLast
|
||||
. advanceScrollAmount
|
||||
. updateWorldEventFlags
|
||||
. maybeOpenTerminal
|
||||
. over (uvWorld . input . textInput) (const mempty)
|
||||
. updateUniverseMid
|
||||
. debugEvents
|
||||
. updateUseInput -- this should be pushed inside when the universe is paused etc
|
||||
-- OR the keys should be tested "in game", so to speak
|
||||
. over uvWorld (updateCamera cfig)
|
||||
. updateUniverseFirst
|
||||
$ u
|
||||
@@ -116,6 +111,10 @@ gotoTerminal w = case _uvScreenLayers w of
|
||||
updateUniverseLast :: Universe -> Universe
|
||||
updateUniverseLast u =
|
||||
u
|
||||
& over (uvWorld . input . textInput) (const mempty)
|
||||
& maybeOpenTerminal
|
||||
& advanceScrollAmount
|
||||
& updateWorldEventFlags
|
||||
& uvWorld . input . pressedKeys . each %~ f
|
||||
& uvWorld . input . mouseMoving .~ False
|
||||
& uvWorld . input . mouseButtons . each +~ 1
|
||||
@@ -129,8 +128,9 @@ updateUniverseLast u =
|
||||
updateUniverseMid :: Universe -> Universe
|
||||
updateUniverseMid u = case _uvScreenLayers u of
|
||||
(OptionScreen{_scOptionFlag = LoadingScreen} : _) -> u
|
||||
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
||||
u & uvWorld
|
||||
(sl@OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
||||
u & updateUseInputOnScreen sl
|
||||
& uvWorld
|
||||
%~ (
|
||||
--updateParticles
|
||||
(cWorld . lWorld . radarBlips .~ [])
|
||||
@@ -138,8 +138,8 @@ updateUniverseMid u = case _uvScreenLayers u of
|
||||
. updateLightSources
|
||||
. updateClouds
|
||||
)
|
||||
(_ : _) -> u
|
||||
[] -> timeFlowUpdate u
|
||||
(sl : _) -> u & updateUseInputOnScreen sl
|
||||
[] -> timeFlowUpdate $ updateUseInputInGame u
|
||||
|
||||
timeFlowUpdate :: Universe -> Universe
|
||||
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
||||
|
||||
@@ -1,13 +1,2 @@
|
||||
module Dodge.Update.Input (
|
||||
updateUseInput,
|
||||
) where
|
||||
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Update.Input.InGame
|
||||
import Dodge.Update.Input.ScreenLayer
|
||||
import Control.Lens
|
||||
|
||||
updateUseInput :: Universe -> Universe
|
||||
updateUseInput u = case u ^? uvScreenLayers . _head of
|
||||
Just sl -> updateUseInputOnScreen sl u
|
||||
Nothing -> updateUseInputInGame (u ^. uvWorld . hud . hudElement) u
|
||||
|
||||
@@ -29,8 +29,8 @@ import Geometry
|
||||
import LensHelp
|
||||
import SDL
|
||||
|
||||
updateUseInputInGame :: HUDElement -> Universe -> Universe
|
||||
updateUseInputInGame h u = case h of
|
||||
updateUseInputInGame :: Universe -> Universe
|
||||
updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
DisplayCarte -> over uvWorld updatePressedButtonsCarte u
|
||||
DisplayInventory{_subInventory = si} -> case si of
|
||||
DisplayTerminal tmid
|
||||
|
||||
Reference in New Issue
Block a user