Add view debug option

This commit is contained in:
2021-10-03 18:47:11 +01:00
parent b526517404
commit df9a8ea242
7 changed files with 35 additions and 53 deletions
+14
View File
@@ -15,6 +15,8 @@ import Dodge.Render.MenuScreen
import Dodge.Render.ShapePicture
import Dodge.SoundLogic.LoadSound
import Dodge.Config.Data
import Dodge.GameRoom
import Dodge.Update.Camera
import Sound.Data
import Geometry
import Picture
@@ -40,6 +42,7 @@ worldPictures w = pictures
,concatMapPic btDraw $ _buttons w
,concatMapPic drawWallFloor $ wallFloorsToDraw w
,soundPics w
,viewBoundaries w
]
where
crIsClose cr = dist (_crPos cr) camCen < winSize
@@ -74,12 +77,23 @@ testPic _ = []
-- thepic = setDepth 20 . color green . polygon $ rectNSEW 5 (-5) (-5) (5)
--testPic _ = blank
--testPic w = color green . pictures . map (flip thickLine 5 . tflat2) . graphToEdges $ _pathGraph w
viewBoundaries :: World -> Picture
viewBoundaries w
| _debug_view_boundaries (_config w)
= setLayer 5 $ color green (concatMap (polygonWire . _grBound) grs)
<> color yellow (concatMap (\q -> line [p,q]) $ farWallPoints p w)
| otherwise = []
where
p = _crPos $ you w
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
soundPics :: World -> Picture
soundPics w
| _show_sound (_config w) = pictures $ M.map (soundPic w) $ _playingSounds w
| otherwise = []
soundPic :: World -> Sound -> Picture
soundPic w s = fixedSizePicClampArrow 50 50 thePic p w
where