Count mouse button press time up from 0

This commit is contained in:
2023-04-27 11:39:42 +01:00
parent 9972e0fdea
commit 5b1212e4f6
6 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -91,7 +91,7 @@ updateUniverseFirst u =
setClickWorldPos :: Universe -> M.Map MouseButton Point2
setClickWorldPos u = fmap
(const (screenToWorldPos (u ^. uvWorld . wCam) (u ^. uvWorld . input . mousePos)))
(M.filter (== 1) $ u ^. uvWorld . input . mouseButtons)
(M.filter (== 0) $ u ^. uvWorld . input . mouseButtons)
updateWorldEventFlags :: Universe -> Universe
updateWorldEventFlags u =
@@ -162,13 +162,13 @@ pauseTime itmloc w
| justPressedButtonLeft || outofcharge = w & timeFlow .~ NormalTimeFlow
| otherwise = w & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itmloc) . itUse . leftConsumption . wpCharge -~ 1
where
justPressedButtonLeft = w ^? input . mouseButtons . ix ButtonLeft == Just 1
justPressedButtonLeft = w ^? input . mouseButtons . ix ButtonLeft == Just 0
outofcharge = maybe True (== 0) charge
charge = w ^? pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itmloc) . itUse . leftConsumption . wpCharge
doItemTimeScroll :: Int -> World -> World
doItemTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
Just 1 -> w & timeFlow .~ NormalTimeFlow
Just 0 -> w & timeFlow .~ NormalTimeFlow
_ -> doTimeScroll smoothing w
doTimeScroll :: Int -> World -> World