Continue reload refactor

This commit is contained in:
2022-06-21 14:07:17 +01:00
parent 14a7189b44
commit 53c8be0679
33 changed files with 106 additions and 115 deletions
+7 -7
View File
@@ -81,7 +81,7 @@ moveZoomCamera cfig w = w
updateScopeZoom :: World -> World
updateScopeZoom w
| SDL.ButtonRight `S.member` _mouseButtons w
= case w ^? creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
= case w ^? creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
. itScope . scopeZoomChange of
Just x
| x > 10 -> zoomInLongGun $ zoomInLongGun $ zoomInLongGun w
@@ -92,7 +92,7 @@ updateScopeZoom w
| x < 0 -> zoomOutLongGun w
| otherwise -> w
_ -> w
| otherwise = w & creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
| otherwise = w & creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
. itScope %~ updateScope
where
updateScope (ZoomScope _ _ _ defz bl) = ZoomScope (V2 0 0) 0 defz defz bl
@@ -110,8 +110,8 @@ zoomInLongGun w
| otherwise = w & wpPointer . itScope . scopeZoomChange .~ 0
where
decreaseScopeZoomChange = wpPointer . itScope . scopeZoomChange -~ 1
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
wpPointer = creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
wp = _crInv (_creatures w IM.! 0) IM.! crSel (_creatures w IM.! 0)
Just currentZoom = wp ^? itScope . scopeZoom
newzoom = (wp ^?! itScope . scopeZoom) / zoomSpeed
mousep = rotateV (_cameraRot w) $ _mousePos w
@@ -127,8 +127,8 @@ zoomOutLongGun w
where
--mousep = rotateV (_cameraRot w) $ _mousePos w
increaseScopeZoomChange = wpPointer . itScope . scopeZoomChange +~ 1
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
wp = _crInv (_creatures w IM.! 0) IM.! _crInvSel (_creatures w IM.! 0)
wpPointer = creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
wp = _crInv (_creatures w IM.! 0) IM.! crSel (_creatures w IM.! 0)
Just currentZoom = wp ^? itScope . scopeZoom
ifConfigWallRotate :: Configuration -> World -> World
@@ -156,7 +156,7 @@ rotateToOverlappingWall w = maybe w dowallrotate
rotateCameraBy :: Float -> World -> World
rotateCameraBy x w = w
& cameraRot +~ x
& creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
& creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0))
. itScope . scopePos %~ rotateV x
rotateCamera :: Configuration -> World -> World