Empty Update/UsingInput

This commit is contained in:
2023-02-19 12:27:16 +00:00
parent b615d6ce57
commit 1028fa7d88
2 changed files with 20 additions and 27 deletions
+1 -26
View File
@@ -1,6 +1,6 @@
{- Functions that affect the world according to what pressed buttons are stored in a Set. -}
module Dodge.Update.UsingInput (
updateUsingInput,
-- updateUsingInput,
) where
import Control.Lens
@@ -18,18 +18,7 @@ import Dodge.Terminal.LeftButton
import Geometry
import SDL
updateUsingInput :: World -> World
updateUsingInput w = case w ^. hud . hudElement of
DisplayInventory {_subInventory = subinv} ->
pressedMBEffects subinv (_mouseButtons (_input w)) w
DisplayCarte -> w
pressedMBEffects :: SubInventory -> M.Map MouseButton Bool -> World -> World
pressedMBEffects subinv pkeys w = case subinv of
NoSubInventory -> pressedMBEffectsNoInventory pkeys w
_ -> w
where
lbinitialpress = pkeys ^? ix ButtonLeft == Just False
-- maybeexitcombine w'
-- | ButtonRight `M.member` _mouseButtons (_input w) =
-- (hud . hudElement . subInventory . subInvMap %~ setShownIntMap) $
@@ -37,20 +26,6 @@ pressedMBEffects subinv pkeys w = case subinv of
-- | otherwise = w' & hud . hudElement . subInventory .~ NoSubInventory
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
pressedMBEffectsNoInventory pkeys w
| isDown ButtonLeft && isDown ButtonRight && inTopInv = useItem (you w) w
| isDown ButtonLeft && inTopInv = useLeftItem 0 w
| isDown ButtonMiddle =
w & cWorld . camPos . camRot -~ rotation
& input . clickMousePos .~ _mousePos (_input w)
| otherwise = w
where
inTopInv = case w ^. hud . hudElement of
DisplayInventory {_subInventory = NoSubInventory} -> True
_ -> False
isDown but = but `M.member` pkeys
rotation = angleBetween (_mousePos (_input w)) (_clickMousePos (_input w))
-- note "sort" on the inventory indices; otherwise
-- lower items may be shifted up and items below these removed instead