Record whether a mouse click is continued or not

This commit is contained in:
2022-06-22 17:02:57 +01:00
parent ac0948cb64
commit 698ccb414d
18 changed files with 350 additions and 335 deletions
+5 -4
View File
@@ -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