Cleanup
This commit is contained in:
+4
-6
@@ -6,6 +6,7 @@ Consider splitting. -}
|
||||
module Dodge.Base
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.WinScale
|
||||
import Dodge.Zone
|
||||
--import Dodge.Zone.Data
|
||||
import Dodge.Base.Window
|
||||
@@ -458,8 +459,8 @@ worldPosToScreenNorm cfig w = doWindowScale . doRotate . doZoom . doTranslate
|
||||
doZoom p = _cameraZoom w *.* p
|
||||
doRotate p = rotateV (negate $ _cameraRot w) p
|
||||
doWindowScale (V2 x y) = V2
|
||||
( x * 2 / getWindowX cfig)
|
||||
( y * 2 / getWindowY cfig)
|
||||
( x * 2 / _windowX cfig)
|
||||
( y * 2 / _windowY cfig)
|
||||
{- | Transform world coordinates to scaled screen coordinates.
|
||||
- These have to be according to the size of the window to get actual screen positions.
|
||||
- This allows for line thicknesses etc to correspond to pixel sizes.-}
|
||||
@@ -472,14 +473,11 @@ worldPosToScreen w = doRotate . doZoom . doTranslate
|
||||
{- | Transform coordinates from the map position to screen
|
||||
coordinates. -}
|
||||
cartePosToScreen :: Configuration -> World -> Point2 -> Point2
|
||||
cartePosToScreen cfig w = doWindowScale . doRotate . doZoom . doTranslate
|
||||
cartePosToScreen cfig w = doWindowScale cfig . doRotate . doZoom . doTranslate
|
||||
where
|
||||
doTranslate p = p -.- _carteCenter w
|
||||
doZoom p = _carteZoom w *.* p
|
||||
doRotate p = rotateV (negate $ _carteRot w) p
|
||||
doWindowScale (V2 x y) = V2
|
||||
( x * 2 / getWindowX cfig)
|
||||
( y * 2 / getWindowY cfig)
|
||||
{- | The mouse position in world coordinates. -}
|
||||
mouseWorldPos :: World -> Point2
|
||||
mouseWorldPos w = _cameraCenter w +.+ (1/_cameraZoom w) *.* rotateV (_cameraRot w) (_mousePos w)
|
||||
|
||||
Reference in New Issue
Block a user