Refactor text input

This commit is contained in:
2022-10-30 11:57:53 +00:00
parent 9779b6fa39
commit 6123795c7a
7 changed files with 49 additions and 74 deletions
+7 -2
View File
@@ -63,7 +63,10 @@ import Sound.Data
import StrictHelp
updateUniverse :: Universe -> Universe
updateUniverse u = updateUniverseLast . updateUniverseMid
updateUniverse u =
updateUniverseLast
. over (uvWorld . input . textInput) (const mempty)
. updateUniverseMid
. updateUseInput
. over uvWorld (updateCamera cfig)
. over (uvWorld . cWorld . cClock) ( + 1)
@@ -72,7 +75,9 @@ updateUniverse u = updateUniverseLast . updateUniverseMid
cfig = u ^. uvConfig
updateUseInput :: Universe -> Universe
updateUseInput u = M.foldlWithKey' updateKeyInGame u (u ^. uvWorld . input . pressedKeys)
updateUseInput u = case u ^? uvScreenLayers . _head of
Just InputScreen{} -> doInputScreenInput u
_ -> M.foldlWithKey' updateKeyInGame u (u ^. uvWorld . input . pressedKeys)
updateUniverseLast :: Universe -> Universe