Record whether a mouse click is continued or not
This commit is contained in:
@@ -16,6 +16,7 @@ import Geometry
|
||||
import Dodge.GameRoom
|
||||
import LensHelp
|
||||
|
||||
import qualified Data.Map.Strict as M
|
||||
--import qualified Data.List.NonEmpty as NEL
|
||||
--import Control.Applicative
|
||||
import Data.Foldable
|
||||
@@ -48,10 +49,10 @@ moveZoomCamera cfig w = w
|
||||
vfoffset = do
|
||||
iscam <- yourItem w ^? _Just . itScope . scopeIsCamera
|
||||
guard iscam
|
||||
guard (SDL.ButtonRight `S.member` _mouseButtons w)
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons w)
|
||||
yourItem w ^? _Just . itScope . scopePos
|
||||
mscopeoffset = do
|
||||
guard (SDL.ButtonRight `S.member` _mouseButtons w)
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons w)
|
||||
yourItem w ^? _Just . itScope . scopePos
|
||||
newcen = cpos +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset
|
||||
offset = rotateV (_cameraRot w) $ ((newzoom - newDefaultZoom)/(newDefaultZoom*newzoom)) *.* _mousePos w
|
||||
@@ -80,7 +81,7 @@ moveZoomCamera cfig w = w
|
||||
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w
|
||||
| SDL.ButtonRight `M.member` _mouseButtons w
|
||||
= case w ^? creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
|
||||
. itScope . scopeZoomChange of
|
||||
Just x
|
||||
@@ -133,7 +134,7 @@ zoomOutLongGun w
|
||||
|
||||
ifConfigWallRotate :: Configuration -> World -> World
|
||||
ifConfigWallRotate cfig w
|
||||
| _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `S.member` _mouseButtons w)
|
||||
| _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` _mouseButtons w)
|
||||
= rotateToOverlappingWall w
|
||||
| otherwise = w
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import Dodge.Creature.Impulse.UseItem
|
||||
import Geometry
|
||||
|
||||
import SDL
|
||||
import qualified Data.Set as S
|
||||
--import qualified Data.Set as S
|
||||
import qualified Data.Map.Strict as M
|
||||
import Control.Lens
|
||||
|
||||
updateUsingInput :: World -> World
|
||||
@@ -16,7 +17,7 @@ updateUsingInput w = case _hudElement $ _hud w of
|
||||
DisplayInventory {} -> updatePressedButtons (_mouseButtons w) w
|
||||
DisplayCarte -> updatePressedButtonsCarte (_mouseButtons w) w
|
||||
|
||||
updatePressedButtons :: S.Set MouseButton -> World -> World
|
||||
updatePressedButtons :: M.Map MouseButton Bool -> World -> World
|
||||
updatePressedButtons pkeys w
|
||||
| isDown ButtonLeft && isDown ButtonRight && inTopInv
|
||||
= useItem (you w) w & doubleMouseHammer .~ HammerDown
|
||||
@@ -34,11 +35,10 @@ updatePressedButtons pkeys w
|
||||
inTopInv = case _hudElement (_hud w) of
|
||||
DisplayInventory NoSubInventory -> True
|
||||
_ -> False
|
||||
isDown but = but `S.member` pkeys
|
||||
isDown but = but `M.member` pkeys
|
||||
rotation = angleBetween (_mousePos w) (_clickMousePos w)
|
||||
|
||||
|
||||
updatePressedButtonsCarte :: S.Set MouseButton -> World -> World
|
||||
updatePressedButtonsCarte :: M.Map MouseButton Bool -> World -> World
|
||||
updatePressedButtonsCarte pkeys w
|
||||
| isDown ButtonRight = w
|
||||
& clickMousePos .~ _mousePos w
|
||||
@@ -49,7 +49,7 @@ updatePressedButtonsCarte pkeys w
|
||||
& hud . carteZoom *~ czoom
|
||||
| otherwise = w
|
||||
where
|
||||
isDown but = but `S.member` pkeys
|
||||
isDown but = but `M.member` pkeys
|
||||
rot = angleBetween (_mousePos w) (_clickMousePos w)
|
||||
czoom = magV (_mousePos w) / magV (_clickMousePos w)
|
||||
trans = rotateV (_carteRot (_hud w)) $ 1 / _carteZoom (_hud w) *.* (_mousePos w -.- _clickMousePos w)
|
||||
|
||||
Reference in New Issue
Block a user