Zoom in when spawning

This commit is contained in:
2025-12-06 00:04:00 +00:00
parent f9ce58b409
commit 189c3da84f
6 changed files with 75 additions and 72 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ module Dodge.Base.Window (
pointIsOnScreen,
) where
import Linear
import Control.Lens
import Dodge.Data.Camera
import Dodge.Data.Config
@@ -19,9 +20,9 @@ screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
where
scRot = rotateV (w ^. camRot)
scZoom p
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *.* p
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *^ p
| otherwise = p
scTran p = p +.+ (w ^. camCenter)
scTran p = p + (w ^. camCenter)
-- | A box covering the screen in world coordinates, with a x and y border
screenPolygonBord ::
@@ -37,9 +38,9 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
hw = halfWidth cfig - xbord
hh = halfHeight cfig - ybord
scZoom p
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *.* p
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *^ p
| otherwise = p
theTransform = (+.+ (w ^. camCenter)) . rotateV (w ^. camRot) . scZoom
theTransform = (+ (w ^. camCenter)) . rotateV (w ^. camRot) . scZoom
tr = theTransform (V2 hw hh)
tl = theTransform (V2 (- hw) hh)
br = theTransform (V2 hw (- hh))