This commit is contained in:
2023-05-10 01:45:29 +01:00
parent cd42e29012
commit f569f3f173
2 changed files with 31 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
module Dodge.ScreenPos where
import Dodge.Base.Window
import Dodge.Data.Config
import Dodge.Data.ScreenPos
import Geometry.Data
import Picture.Base
import Control.Lens
fromTopLeft :: Point2 -> ScreenPos
fromTopLeft (V2 x y) = ScreenPos (V2 (-0.5) 0.5) (V2 x (- y))
translateScreenPos :: Configuration -> ScreenPos -> Picture -> Picture
translateScreenPos cfig sp = translate x y
where
V2 x y = sp ^. spScreenOff * V2 hw hh + sp ^. spPixelOff
hw = halfWidth cfig
hh = halfHeight cfig