Refactoring
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{- | Getting the window size geometry. -}
|
||||
module Dodge.Base.Window
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Config.Data
|
||||
import Geometry
|
||||
|
||||
screenPolygon :: World -> [Point2]
|
||||
screenPolygon w = [tr,tl,bl,br]
|
||||
where
|
||||
scRot = rotateV (_cameraRot w)
|
||||
scZoom p | _cameraZoom w /= 0 = (1/_cameraZoom w) *.* p
|
||||
scTran p = p +.+ _cameraCenter w
|
||||
tr = scTran $ scRot $ scZoom ( halfWidth w, halfHeight w)
|
||||
tl = scTran $ scRot $ scZoom (-halfWidth w, halfHeight w)
|
||||
br = scTran $ scRot $ scZoom ( halfWidth w,-halfHeight w)
|
||||
bl = scTran $ scRot $ scZoom (-halfWidth w,-halfHeight w)
|
||||
|
||||
halfWidth,halfHeight :: World -> Float
|
||||
halfWidth w = getWindowX w / 2
|
||||
halfHeight w = getWindowY w / 2
|
||||
|
||||
getWindowX = _windowX . _config
|
||||
getWindowY = _windowY . _config
|
||||
Reference in New Issue
Block a user