Cleanup
This commit is contained in:
@@ -12,7 +12,7 @@ import Dodge.Data.Input
|
||||
import Geometry
|
||||
|
||||
---- | Transform coordinates from world position to screen coordinates.
|
||||
--worldPosToScreenNorm :: Configuration -> World -> Point2 -> Point2
|
||||
--worldPosToScreenNorm :: Config -> World -> Point2 -> Point2
|
||||
--worldPosToScreenNorm cfig w = doWindowScale cfig . doRotate . doZoom . doTranslate
|
||||
-- where
|
||||
-- doTranslate p = p -.- (w ^. cWorld . lWorld . wCam . cwcCenter)
|
||||
|
||||
@@ -14,7 +14,7 @@ import Dodge.Data.Config
|
||||
import Geometry
|
||||
|
||||
-- | A box covering the screen in world coordinates
|
||||
screenPolygon :: Configuration -> Camera -> [Point2]
|
||||
screenPolygon :: Config -> Camera -> [Point2]
|
||||
screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
|
||||
where
|
||||
scRot = rotateV (w ^. camRot)
|
||||
@@ -29,7 +29,7 @@ screenPolygonBord ::
|
||||
Float ->
|
||||
-- | Y border
|
||||
Float ->
|
||||
Configuration ->
|
||||
Config ->
|
||||
Camera ->
|
||||
[Point2]
|
||||
screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
|
||||
@@ -45,16 +45,16 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
|
||||
br = theTransform (V2 hw (- hh))
|
||||
bl = theTransform (V2 (- hw) (- hh))
|
||||
|
||||
halfWidth, halfHeight :: Configuration -> Float
|
||||
halfWidth, halfHeight :: Config -> Float
|
||||
halfWidth = (0.5 *) . windowXFloat
|
||||
halfHeight = (0.5 *) . windowYFloat
|
||||
|
||||
-- | A box of the size of the screen in screen centered coordinates
|
||||
screenBox :: Configuration -> [Point2]
|
||||
screenBox :: Config -> [Point2]
|
||||
screenBox w = rectNSWE hh (- hh) (- hw) hw
|
||||
where
|
||||
hw = halfWidth w
|
||||
hh = halfHeight w
|
||||
|
||||
pointIsOnScreen :: Configuration -> Camera -> Point2 -> Bool
|
||||
pointIsOnScreen :: Config -> Camera -> Point2 -> Bool
|
||||
pointIsOnScreen cfig w p = pointInPolygon p $ screenPolygon cfig w
|
||||
|
||||
Reference in New Issue
Block a user