Implement floating camera

This commit is contained in:
2023-03-26 16:44:19 +01:00
parent 082ce9c9a1
commit 73e742e1a2
12 changed files with 86 additions and 38 deletions
+6
View File
@@ -2,6 +2,7 @@ module Dodge.Base.Coordinate (
mouseWorldPos,
cartePosToScreen,
worldPosToScreen,
screenToWorldPos,
) where
import Control.Lens
@@ -47,6 +48,11 @@ mouseWorldPos inp cam =
(cam ^. camCenter)
+.+ (1 / (cam ^. camZoom)) *.* rotateV (cam ^. camRot) (_mousePos inp)
screenToWorldPos :: Camera -> Point2 -> Point2
screenToWorldPos cam p =
(cam ^. camCenter)
+.+ (1 / (cam ^. camZoom)) *.* rotateV (cam ^. camRot) p
---- | The mouse position in map coordinates
--mouseCartePos :: World -> Point2
--mouseCartePos w = (thehud ^. carteCenter)