This commit is contained in:
2025-01-16 12:38:56 +00:00
parent 6eacce30fe
commit 4932952ed4
+9 -14
View File
@@ -139,23 +139,18 @@ rotateCamera :: Configuration -> World -> World
rotateCamera cfig w
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
, Just rtime <- pkeys ^? ix SDL.ButtonRight
, rtime > 0
, ltime > rtime =
, rtime > 0
, ltime > rtime
, Just rotation <-
angleBetween (w ^. input . mousePos)
<$> (w ^. input . heldPos . at SDL.ButtonRight) =
w & wCam . camRot -~ rotation
| otherwise = ifConfigWallRotate cfig (w ^. input . mouseButtons) w
| _gameplay_rotate_to_wall cfig
, isNothing $ pkeys ^? ix SDL.ButtonRight =
rotateToOverlappingWall w
| otherwise = w
where
pkeys = w ^. input . mouseButtons
rotation =
maybe
0
(angleBetween $ w ^. input . mousePos)
(w ^. input . heldPos . at SDL.ButtonRight)
ifConfigWallRotate :: Configuration -> M.Map MouseButton Int -> World -> World
ifConfigWallRotate cfig mbs
| _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` mbs) =
rotateToOverlappingWall
| otherwise = id
rotateToOverlappingWall :: World -> World
rotateToOverlappingWall w =