Add general smooth scrolling, move camera into world

This commit is contained in:
2023-03-26 20:09:00 +01:00
parent 73e742e1a2
commit 07a1d71039
32 changed files with 154 additions and 131 deletions
+6 -6
View File
@@ -5,7 +5,7 @@ module Dodge.Picture.SizeInvariant
import Control.Lens
import Data.Maybe
import Dodge.Base.Window
import Dodge.Data.CWorld
import Dodge.Data.World
import Dodge.Data.Config
import Geometry
import Picture
@@ -62,7 +62,7 @@ fixedSizePicClampArrow ::
Picture ->
Point2 ->
Configuration ->
CWorld ->
World ->
Picture
fixedSizePicClampArrow xbord ybord pic p cfig w =
pictures
@@ -70,16 +70,16 @@ fixedSizePicClampArrow xbord ybord pic p cfig w =
, setLayer DebugLayer . color white . setDepth 20 $ arrowPic
]
where
winps = screenPolygon cfig (w ^. cwCam)
bords = screenPolygonBord xbord ybord cfig (w ^. cwCam)
winps = screenPolygon cfig (w ^. wCam)
bords = screenPolygonBord xbord ybord cfig (w ^. wCam)
borderPoint = intersectSegPolyFirst campos p bords
windowPoint = intersectSegPolyFirst campos p winps
arrowPic = case borderPoint of
Nothing -> blank
Just bp -> thickLine 5 [bp, fromMaybe p windowPoint]
(V2 x y) = fromMaybe p borderPoint
campos = w ^. cwCam . camCenter
theScale = 1 / (w ^. cwCam . camZoom)
campos = w ^. wCam . camCenter
theScale = 1 / (w ^. wCam . camZoom)
--absClamp ::
-- -- | clamping value, assumed positive