Correctly reduce left click item delay

This commit is contained in:
2022-09-04 10:22:53 +01:00
parent 920bfdbc8e
commit 8c0ad639ad
9 changed files with 30 additions and 56 deletions
+6 -6
View File
@@ -20,16 +20,16 @@ import SDL
updateUsingInput :: World -> World
updateUsingInput w = case _hudElement $ _hud (_cWorld w) of
DisplayInventory subinv ->
updatePressedButtons subinv (_mouseButtons w) w
pressedMBEffects subinv (_mouseButtons w) w
DisplayCarte ->
updatePressedButtonsCarte (_mouseButtons w) w
updatePressedButtons :: SubInventory -> M.Map MouseButton Bool -> World -> World
updatePressedButtons subinv pkeys w = case subinv of
pressedMBEffects :: SubInventory -> M.Map MouseButton Bool -> World -> World
pressedMBEffects subinv pkeys w = case subinv of
NoSubInventory
| ButtonLeft `M.member` pkeys && w ^?! hammers . ix SubInvHam /= HammerUp ->
w & hammers . ix SubInvHam .~ HammerDown
| otherwise -> updatePressedButtons' pkeys w
| otherwise -> pressedMBEffectsNoInventory pkeys w
CombineInventory mi
| pkeys ^? ix ButtonLeft == Just False ->
maybeexitcombine (maybe id doCombine mi w) & hammers . ix SubInvHam .~ HammerDown
@@ -49,8 +49,8 @@ updatePressedButtons subinv pkeys w = case subinv of
| ButtonRight `M.member` _mouseButtons w = id
| otherwise = cWorld . hud . hudElement .~ DisplayInventory NoSubInventory
updatePressedButtons' :: M.Map MouseButton Bool -> World -> World
updatePressedButtons' pkeys w
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
pressedMBEffectsNoInventory pkeys w
| isDown ButtonLeft && isDown ButtonRight && inTopInv =
useItem (you w) w & hammers . ix DoubleMouseHam .~ HammerDown
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)