Cleanup. Only update draw distance every 5 frames
This commit is contained in:
@@ -91,14 +91,14 @@ moveZoomCamera cfig theinput cr campos =
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix i . itScope . remotePos)
|
||||
mscopeoffset = do
|
||||
camrot = campos ^. camRot
|
||||
newcen = _crPos cr +.+ offset
|
||||
offset = fromMaybe noscopeoffset $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(fmap (rotateV camrot) (cr ^? crInv . ix i . itScope . opticPos))
|
||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||
camrot = campos ^. camRot
|
||||
newcen = _crPos cr +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset
|
||||
offset =
|
||||
noscopeoffset =
|
||||
rotateV (campos ^. camRot) $
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
@@ -131,7 +131,6 @@ moveZoomCamera cfig theinput cr campos =
|
||||
-- is wanted
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w = fromMaybe w $ do
|
||||
--i <- yourScopeInvID w
|
||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
return $ updateScopeZoom' i w
|
||||
|
||||
@@ -251,10 +250,11 @@ findBoundDists cfig w
|
||||
hh = halfHeight cfig
|
||||
|
||||
updateBounds :: Configuration -> World -> World
|
||||
updateBounds cfig w =
|
||||
w
|
||||
updateBounds cfig w = case (w ^. cWorld . cClock) `mod` 5 of
|
||||
0 -> w
|
||||
& wCam . camBoundDist .~ bdists
|
||||
& wCam . camBoundBox
|
||||
.~ map ((+.+ w ^. wCam . camCenter) . rotateV (w ^. wCam . camRot)) (rectNSWE n s w' e)
|
||||
_ -> w
|
||||
where
|
||||
bdists@(n, s, e, w') = findBoundDists cfig w
|
||||
|
||||
Reference in New Issue
Block a user