Move towards serializing saves/loads faster
This commit is contained in:
@@ -9,18 +9,17 @@ module Dodge.Base.Window (
|
||||
|
||||
import Dodge.Data.Universe
|
||||
import Geometry
|
||||
import Control.Lens
|
||||
|
||||
-- | A box covering the screen in world coordinates
|
||||
screenPolygon :: Configuration -> World -> [Point2]
|
||||
screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
|
||||
where
|
||||
-- [tr,tl,bl,br]
|
||||
|
||||
scRot = rotateV (_cameraRot (_cWorld w))
|
||||
scRot = rotateV (w ^. cWorld . cwCam . cwcRot)
|
||||
scZoom p
|
||||
| _cameraZoom (_cWorld w) /= 0 = (1 / _cameraZoom (_cWorld w)) *.* p
|
||||
| (w ^. cWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . cwCam . cwcZoom)) *.* p
|
||||
| otherwise = p
|
||||
scTran p = p +.+ _cameraCenter (_cWorld w)
|
||||
scTran p = p +.+ (w ^. cWorld . cwCam . cwcCenter)
|
||||
|
||||
-- tr = scTran $ scRot $ scZoom (V2 ( halfWidth w) ( halfHeight w))
|
||||
-- tl = scTran $ scRot $ scZoom (V2 (-halfWidth w) ( halfHeight w))
|
||||
@@ -41,9 +40,9 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
|
||||
hw = halfWidth cfig - xbord
|
||||
hh = halfHeight cfig - ybord
|
||||
scZoom p
|
||||
| _cameraZoom (_cWorld w) /= 0 = (1 / _cameraZoom (_cWorld w)) *.* p
|
||||
| (w ^. cWorld . cwCam . cwcZoom) /= 0 = (1 / (w ^. cWorld . cwCam . cwcZoom)) *.* p
|
||||
| otherwise = p
|
||||
theTransform = (+.+ _cameraCenter (_cWorld w)) . rotateV (_cameraRot (_cWorld w)) . scZoom
|
||||
theTransform = (+.+ (w ^. cWorld . cwCam . cwcCenter)) . rotateV (w ^. cWorld . cwCam . cwcRot) . scZoom
|
||||
tr = theTransform (V2 hw hh)
|
||||
tl = theTransform (V2 (- hw) hh)
|
||||
br = theTransform (V2 hw (- hh))
|
||||
|
||||
Reference in New Issue
Block a user