Move in game key press input reaction to universe update
This commit is contained in:
+10
-2
@@ -7,8 +7,7 @@ Description : Simulation update
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Color
|
||||
--import Dodge.Zone
|
||||
|
||||
import Dodge.Update.Input
|
||||
import Dodge.Update.Scroll
|
||||
import Control.Applicative
|
||||
import Data.List
|
||||
@@ -65,14 +64,23 @@ import StrictHelp
|
||||
|
||||
updateUniverse :: Universe -> Universe
|
||||
updateUniverse u = updateUniverseLast . updateUniverseMid
|
||||
. updateUseInput
|
||||
. over uvWorld (updateCamera cfig)
|
||||
. over (uvWorld . cWorld . cClock) ( + 1)
|
||||
$ updateBounds u -- where should this go? next to update camera?
|
||||
where
|
||||
cfig = u ^. uvConfig
|
||||
|
||||
updateUseInput :: Universe -> Universe
|
||||
updateUseInput u = M.foldlWithKey' updateKeyInGame u (u ^. uvWorld . input . pressedKeys)
|
||||
|
||||
|
||||
updateUniverseLast :: Universe -> Universe
|
||||
updateUniverseLast = over uvWorld (input . mouseButtons . each .~ True) -- to determine if the mouse button is held
|
||||
. over uvWorld (input . pressedKeys . each %~ f)
|
||||
where
|
||||
f LongPress = LongPress
|
||||
f _ = ShortPress
|
||||
|
||||
{- For most menus the only way to change the world is using event handling. -}
|
||||
updateUniverseMid :: Universe -> Universe
|
||||
|
||||
Reference in New Issue
Block a user