Add support for clamping pictures to be inside screen

This commit is contained in:
2021-09-10 11:38:24 +01:00
parent 70c97f5367
commit 87a9745d37
4 changed files with 55 additions and 9 deletions
+18 -1
View File
@@ -6,6 +6,7 @@ import Dodge.Base
import Dodge.Base.Window
import Dodge.Base.Zone
import Dodge.Picture
import Dodge.Picture.SizeInvariant
import Dodge.Picture.Layer
import Dodge.Render.HUD
import Dodge.Render.MenuScreen
@@ -18,6 +19,7 @@ import Control.Lens
import Data.Maybe
import Data.List (partition)
import qualified Data.IntMap.Lazy as IM
import qualified Data.Map as M
worldPictures :: World -> Picture
worldPictures w = pictures
@@ -59,9 +61,24 @@ customMouseCursor w =
$ pictures [ line [V2 (-5) 0,V2 5 0] , line [V2 0 (-5),V2 0 5] ]
testPic :: World -> Picture
testPic _ = blank
testPic w = pictures
[ soundPics w
-- , fixedSizePicClampArrow 10 50 thepic (mouseWorldPos w) w
]
-- where
-- 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
soundPics :: World -> Picture
soundPics w = pictures $ M.map (soundPic w) $ _playingSounds w
soundPic :: World -> Sound -> Picture
soundPic w s = fixedSizePicClampArrow 50 50 thePic p w
where
p = _soundPos s
thePic = scale 0.15 0.15 $ text "SOUND"
crDraw :: World -> Creature -> Picture
crDraw w c = _crPict c c w
ppDraw :: PressPlate -> Picture