Move towards serializing saves/loads faster

This commit is contained in:
2022-08-19 11:12:43 +01:00
parent c74d3b04bf
commit 9df0fa8692
38 changed files with 542 additions and 384 deletions
+9 -8
View File
@@ -1,5 +1,6 @@
module Dodge.Picture.SizeInvariant where
import Control.Lens
import Data.Maybe
import Dodge.Base.Window
import Dodge.Data.Universe
@@ -18,9 +19,9 @@ fixedSizePicAt pic p w =
. scale theScale theScale
$ pic
where
campos = _cameraViewFrom (_cWorld w)
campos = w ^. cWorld . cwCam . cwcViewFrom
v = p -.- campos
theScale = 1 / _cameraZoom (_cWorld w)
theScale = 1 / (w ^. cWorld . cwCam . cwcZoom)
(V2 x y) = campos +.+ v
fixedSizePicClamp ::
@@ -40,11 +41,11 @@ fixedSizePicClamp xbord ybord pic p cfig w =
. scale theScale theScale
$ pic
where
r = negate $ _cameraRot (_cWorld w)
z = _cameraZoom (_cWorld w)
campos = _cameraViewFrom (_cWorld w)
r = negate $ w ^. cWorld . cwCam . cwcRot
z = w ^. cWorld . cwCam . cwcZoom
campos = w ^. cWorld . cwCam . cwcViewFrom
v = p -.- campos
theScale = 1 / _cameraZoom (_cWorld w)
theScale = 1 / (w ^. cWorld . cwCam . cwcZoom)
(V2 x y) = campos +.+ rotateV (negate r) (V2 xr' yr')
(V2 xr yr) = rotateV r v
xr' = absClamp ((halfWidth cfig - fromIntegral xbord) / z) xr
@@ -74,8 +75,8 @@ fixedSizePicClampArrow xbord ybord pic p cfig w =
Nothing -> blank
Just bp -> thickLine 5 [bp, fromMaybe p windowPoint]
(V2 x y) = fromMaybe p borderPoint
campos = _cameraCenter (_cWorld w)
theScale = 1 / _cameraZoom (_cWorld w)
campos = w ^. cWorld . cwCam . cwcCenter
theScale = 1 / (w ^. cWorld . cwCam . cwcZoom)
absClamp ::
-- | clamping value, assumed positive