Add stopWatch
This commit is contained in:
+12
-1
@@ -198,7 +198,17 @@ functionalUpdate' u = case u ^. uvWorld . cWorld . timeFlow of
|
||||
ScrollTimeFlow smoothing _ _ _ -> over uvWorld (doTimeScroll smoothing) u
|
||||
RewindLeftClick 0 _ -> u & uvWorld . cWorld . timeFlow .~ NormalTimeFlow
|
||||
RewindLeftClick _ _ -> over uvWorld scrollTimeBack u -- & uvWorld . cWorld . timeFlow .~ NormalTimeFlow
|
||||
_ -> u
|
||||
DeathTime {} -> u
|
||||
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
|
||||
|
||||
pauseTime :: Int -> World -> World
|
||||
pauseTime itmloc w
|
||||
| justPressedButtonLeft || outofcharge = w & cWorld . timeFlow .~ NormalTimeFlow
|
||||
| otherwise = w & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itmloc) . itUse . leftConsumption . wpCharge -~ 1
|
||||
where
|
||||
justPressedButtonLeft = w ^? input . mouseButtons . ix ButtonLeft == Just False
|
||||
outofcharge = maybe True (== 0) charge
|
||||
charge = w ^? pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itmloc) . itUse . leftConsumption . wpCharge
|
||||
|
||||
doTimeScroll :: Int -> World -> World
|
||||
doTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
|
||||
@@ -215,6 +225,7 @@ doTimeScroll' smoothing w = case w ^. input . scrollAmount of
|
||||
_ | smoothing < 0 -> scrollTimeForward w & cWorld . timeFlow . scrollSmoothing +~ 1
|
||||
_ -> w
|
||||
|
||||
|
||||
scrollTimeBack :: World -> World
|
||||
scrollTimeBack w = case w ^? cWorld . pastWorlds . _head of
|
||||
Nothing -> w
|
||||
|
||||
Reference in New Issue
Block a user