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.InputFocus
|
||||||
|
|
||||||
|
import Dodge.Update.Input.InGame
|
||||||
|
import Dodge.Update.Input.ScreenLayer
|
||||||
import Dodge.Debug
|
import Dodge.Debug
|
||||||
import Dodge.SmoothScroll
|
import Dodge.SmoothScroll
|
||||||
import Color
|
import Color
|
||||||
@@ -54,7 +56,6 @@ import Dodge.TmTm
|
|||||||
import Dodge.TractorBeam.Update
|
import Dodge.TractorBeam.Update
|
||||||
import Dodge.Update.Camera
|
import Dodge.Update.Camera
|
||||||
import Dodge.Update.Cloud
|
import Dodge.Update.Cloud
|
||||||
import Dodge.Update.Input
|
|
||||||
import Dodge.Update.Scroll
|
import Dodge.Update.Scroll
|
||||||
import Dodge.Update.WallDamage
|
import Dodge.Update.WallDamage
|
||||||
import Dodge.WallCreatureCollisions
|
import Dodge.WallCreatureCollisions
|
||||||
@@ -71,14 +72,8 @@ import StrictHelp
|
|||||||
updateUniverse :: Universe -> Universe
|
updateUniverse :: Universe -> Universe
|
||||||
updateUniverse u =
|
updateUniverse u =
|
||||||
updateUniverseLast
|
updateUniverseLast
|
||||||
. advanceScrollAmount
|
|
||||||
. updateWorldEventFlags
|
|
||||||
. maybeOpenTerminal
|
|
||||||
. over (uvWorld . input . textInput) (const mempty)
|
|
||||||
. updateUniverseMid
|
. updateUniverseMid
|
||||||
. debugEvents
|
. 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)
|
. over uvWorld (updateCamera cfig)
|
||||||
. updateUniverseFirst
|
. updateUniverseFirst
|
||||||
$ u
|
$ u
|
||||||
@@ -116,6 +111,10 @@ gotoTerminal w = case _uvScreenLayers w of
|
|||||||
updateUniverseLast :: Universe -> Universe
|
updateUniverseLast :: Universe -> Universe
|
||||||
updateUniverseLast u =
|
updateUniverseLast u =
|
||||||
u
|
u
|
||||||
|
& over (uvWorld . input . textInput) (const mempty)
|
||||||
|
& maybeOpenTerminal
|
||||||
|
& advanceScrollAmount
|
||||||
|
& updateWorldEventFlags
|
||||||
& uvWorld . input . pressedKeys . each %~ f
|
& uvWorld . input . pressedKeys . each %~ f
|
||||||
& uvWorld . input . mouseMoving .~ False
|
& uvWorld . input . mouseMoving .~ False
|
||||||
& uvWorld . input . mouseButtons . each +~ 1
|
& uvWorld . input . mouseButtons . each +~ 1
|
||||||
@@ -129,8 +128,9 @@ updateUniverseLast u =
|
|||||||
updateUniverseMid :: Universe -> Universe
|
updateUniverseMid :: Universe -> Universe
|
||||||
updateUniverseMid u = case _uvScreenLayers u of
|
updateUniverseMid u = case _uvScreenLayers u of
|
||||||
(OptionScreen{_scOptionFlag = LoadingScreen} : _) -> u
|
(OptionScreen{_scOptionFlag = LoadingScreen} : _) -> u
|
||||||
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
(sl@OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
||||||
u & uvWorld
|
u & updateUseInputOnScreen sl
|
||||||
|
& uvWorld
|
||||||
%~ (
|
%~ (
|
||||||
--updateParticles
|
--updateParticles
|
||||||
(cWorld . lWorld . radarBlips .~ [])
|
(cWorld . lWorld . radarBlips .~ [])
|
||||||
@@ -138,8 +138,8 @@ updateUniverseMid u = case _uvScreenLayers u of
|
|||||||
. updateLightSources
|
. updateLightSources
|
||||||
. updateClouds
|
. updateClouds
|
||||||
)
|
)
|
||||||
(_ : _) -> u
|
(sl : _) -> u & updateUseInputOnScreen sl
|
||||||
[] -> timeFlowUpdate u
|
[] -> timeFlowUpdate $ updateUseInputInGame u
|
||||||
|
|
||||||
timeFlowUpdate :: Universe -> Universe
|
timeFlowUpdate :: Universe -> Universe
|
||||||
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
||||||
|
|||||||
@@ -1,13 +1,2 @@
|
|||||||
module Dodge.Update.Input (
|
module Dodge.Update.Input (
|
||||||
updateUseInput,
|
|
||||||
) where
|
) 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 LensHelp
|
||||||
import SDL
|
import SDL
|
||||||
|
|
||||||
updateUseInputInGame :: HUDElement -> Universe -> Universe
|
updateUseInputInGame :: Universe -> Universe
|
||||||
updateUseInputInGame h u = case h of
|
updateUseInputInGame u = 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
|
||||||
|
|||||||
Reference in New Issue
Block a user