Refactor window size, update selection cursor on new screen

This commit is contained in:
2023-03-25 09:27:27 +00:00
parent 20c05be23f
commit ea0c942887
57 changed files with 346 additions and 310 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ allVisibleWalls :: World -> [(Point2, Wall)]
{-# INLINE allVisibleWalls #-}
allVisibleWalls w = concatMap (flip (visibleWalls vPos) w . (+.+ vPos)) $ nRays 15
where
vPos = w ^. cWorld . camPos . camViewFrom
vPos = w ^. cWorld . cwCamPos . camViewFrom
overlapCircWalls ::
Point2 ->
+2 -4
View File
@@ -5,9 +5,7 @@ module Dodge.Base.Coordinate (
) where
import Control.Lens
import Dodge.Base.WinScale
import Dodge.Data.CamPos
import Dodge.Data.Config
import Dodge.Data.HUD
import Dodge.Data.Input
import Geometry
@@ -33,8 +31,8 @@ worldPosToScreen cam =
{- | Transform coordinates from the map position to screen
coordinates.
-}
cartePosToScreen :: Configuration -> HUD -> Point2 -> Point2
cartePosToScreen cfig thehud = doWindowScale cfig . doRotate . doZoom . doTranslate
cartePosToScreen :: HUD -> Point2 -> Point2
cartePosToScreen thehud = doRotate . doZoom . doTranslate
where
doTranslate p = p -.- (thehud ^. carteCenter) -- _carteCenter (_hud (_cWorld w))
doZoom p = (thehud ^. carteZoom) *.* p
-12
View File
@@ -1,12 +0,0 @@
module Dodge.Base.WinScale where
import Dodge.Data.Config
import Geometry
import Picture
winScale :: Configuration -> Picture -> Picture
{-# INLINE winScale #-}
winScale cfig = scale (1 / _windowX cfig) (1 / _windowY cfig)
doWindowScale :: Configuration -> Point2 -> Point2
doWindowScale cfig (V2 x y) = V2 (x / _windowX cfig) (y / _windowY cfig)
+2 -2
View File
@@ -45,8 +45,8 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
bl = theTransform (V2 (- hw) (- hh))
halfWidth, halfHeight :: Configuration -> Float
halfWidth w = _windowX w / 2
halfHeight w = _windowY w / 2
halfWidth = (0.5 *) . windowXFloat
halfHeight = (0.5 *) . windowYFloat
-- | A box of the size of the screen in screen centered coordinates
screenBox :: Configuration -> [Point2]