This commit is contained in:
2022-02-13 17:29:32 +00:00
parent eba1713895
commit 40f1d987cb
21 changed files with 109 additions and 171 deletions
+5 -14
View File
@@ -1,6 +1,5 @@
module Dodge.Debug where
import Dodge.Data
import Dodge.Picture
import Dodge.Picture.Layer
import Dodge.Zone
import Dodge.Base
@@ -14,17 +13,8 @@ import qualified Data.IntSet as IS
import Control.Lens
drawCircleAtFor :: Point2 -> Int -> World -> World
drawCircleAtFor p t w = w & props %~
IM.insert k Projectile
{ _pjPos = p
, _pjStartPos = p
, _pjVel = V2 0 0
, _prDraw = \_ -> (,) mempty $ onLayer PtLayer $ uncurryV translate p $ color white $ circleSolid 20
, _pjID = k
, _pjUpdate = \_ -> pjTimerF t k
}
where
k = IM.newKey $ _props w
drawCircleAtFor p t = drawCircleAtForCol p t white
drawCircleAtForCol :: Point2 -> Int -> Color -> World -> World
drawCircleAtForCol p t col w = w & props %~
IM.insert k Projectile
@@ -37,13 +27,14 @@ drawCircleAtForCol p t col w = w & props %~
}
where
k = IM.newKey $ _props w
drawLineForCol :: [Point2] -> Int -> Color -> World -> World
drawLineForCol ps t col w = w & props %~
IM.insert k Projectile
{ _pjPos = head ps
, _pjStartPos = head ps
, _pjVel = V2 0 0
, _prDraw = \_ -> (,) mempty $ onLayer PtLayer $ color col $ lineOfThickness 5 ps
, _prDraw = \_ -> (,) mempty $ onLayer PtLayer $ color col $ thickLine 5 ps
, _pjID = k
, _pjUpdate = \_ -> pjTimerF t k
}
@@ -66,7 +57,7 @@ debugWallZoningPic :: World -> Picture
debugWallZoningPic w = setLayer 1 $ zonesPic `appendPic` wallsPic
where
wallsPic = setDepth 25 . color yellow . concatMapPic (drawTheWall . _wlLine) $ IM.elems theWalls
drawTheWall (a,b) = lineOfThickness 20 [a,b]
drawTheWall (a,b) = thickLine 20 [a,b]
theWalls = wallsAlongLine sp ep w
zonesPic = setDepth 20 $ drawDDA zones
zones = ddaExt zoneSize sp ep