Start to generalise text input to "terminal signal" input

This commit is contained in:
2023-03-26 13:57:26 +01:00
parent cfb0a49059
commit 082ce9c9a1
39 changed files with 171 additions and 165 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ allVisibleWalls :: World -> [(Point2, Wall)]
{-# INLINE allVisibleWalls #-}
allVisibleWalls w = concatMap (flip (visibleWalls vPos) w . (+.+ vPos)) $ nRays 15
where
vPos = w ^. cWorld . cwCamPos . camViewFrom
vPos = w ^. cWorld . cwCam . camViewFrom
overlapCircWalls ::
Point2 ->
+3 -3
View File
@@ -5,7 +5,7 @@ module Dodge.Base.Coordinate (
) where
import Control.Lens
import Dodge.Data.CamPos
import Dodge.Data.Camera
import Dodge.Data.HUD
import Dodge.Data.Input
import Geometry
@@ -22,7 +22,7 @@ import Geometry
- These have to be scaled according to the size of the window to get actual screen positions.
- This allows for line thicknesses etc to correspond to pixel sizes.
-}
worldPosToScreen :: CamPos -> Point2 -> Point2
worldPosToScreen :: Camera -> Point2 -> Point2
worldPosToScreen cam =
rotateV (negate $ cam ^. camRot)
. ((cam ^. camZoom) *.*)
@@ -42,7 +42,7 @@ cartePosToScreen thehud = doRotate . doZoom . doTranslate
--crToMousePosOffset cr w = (mouseWorldPos w -.- _crPos cr, 0)
-- | The mouse position in world coordinates.
mouseWorldPos :: Input -> CamPos -> Point2
mouseWorldPos :: Input -> Camera -> Point2
mouseWorldPos inp cam =
(cam ^. camCenter)
+.+ (1 / (cam ^. camZoom)) *.* rotateV (cam ^. camRot) (_mousePos inp)
+3 -3
View File
@@ -7,13 +7,13 @@ module Dodge.Base.Window (
screenBox,
) where
import Dodge.Data.CamPos
import Dodge.Data.Camera
import Dodge.Data.Config
import Geometry
import Control.Lens
-- | A box covering the screen in world coordinates
screenPolygon :: Configuration -> CamPos -> [Point2]
screenPolygon :: Configuration -> Camera -> [Point2]
screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
where
scRot = rotateV (w ^. camRot)
@@ -29,7 +29,7 @@ screenPolygonBord ::
-- | Y border
Float ->
Configuration ->
CamPos ->
Camera ->
[Point2]
screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
where