Improve window drawing

This commit is contained in:
2025-10-28 09:58:44 +00:00
parent d6c4d3d609
commit 10503da955
9 changed files with 58 additions and 42 deletions
+6 -3
View File
@@ -24,6 +24,7 @@ import Dodge.Zoning.Wall
import Geometry
import LensHelp
import SDL (MouseButton (..))
import qualified SDL as SDL
{- Update the screen camera rotation and position, including any in rold scope/remote camera modifiers;
update where your avatar's view is from. -}
@@ -63,10 +64,12 @@ translateFloatingCamera theinput cam = fromMaybe cam $ do
translateFloatingCameraKeys :: Input -> Camera -> Camera
translateFloatingCameraKeys theinput cam =
cam
& camCenter -~ thetran
& camViewFrom -~ thetran
& camCenter -~ x
& camViewFrom -~ y
where
thetran = rotateV (cam ^. camRot) $ negate 10 *.* wasdDir theinput
x = rotateV (cam ^. camRot) $ negate 10 *.* wasdDir theinput
y | SDL.ScancodeLShift `M.member` (theinput ^. pressedKeys) = 0
| otherwise = x
zoomFloatingCamera :: Input -> Camera -> Camera
zoomFloatingCamera theinput
+11 -3
View File
@@ -3,6 +3,7 @@ module Dodge.Update.WallDamage (updateWallDamages, updateEdgesWall) where
import Control.Lens
import Data.Foldable
import Data.Maybe
import Data.Monoid
import qualified Data.Set as S
import Dodge.Data.World
import Dodge.Wall.Damage
@@ -23,9 +24,16 @@ updateWallDamages w =
updateEdgesWall :: S.Set Int2 -> World -> World
updateEdgesWall is w =
updateEdgesWall'
(zonesExtract (w ^. incEdgeZoning & each . each %~ S.fromList) is)
w
hack $
updateEdgesWall'
(zonesExtract (w ^. incEdgeZoning & each . each %~ S.fromList) is)
w
where
hack w'
| null is = w'
| otherwise =
(foldMap Sum $ w' ^.. cWorld . incGraph . each . each . seObstacles . to length)
`seq` w'
updateEdgesWall' :: S.Set (Int, Int) -> World -> World
updateEdgesWall' = flip $ foldl' updateEdgeWallObs