Abstract out block placement

This commit is contained in:
2022-06-27 13:38:46 +01:00
parent c8710fe92a
commit fec72cdf48
14 changed files with 105 additions and 55 deletions
+21 -1
View File
@@ -1,10 +1,30 @@
module Dodge.Wire where
--import Dodge.LevelGen.Data
import Dodge.Default.Foreground
import Dodge.Data
import Geometry
import LensHelp
import ShapePicture
import Shape
import Color
import Dodge.Room.Foreground
import qualified Data.IntMap.Strict as IM
import Control.Lens
floorWire :: Point2 -> Point2 -> ForegroundShape
floorWire a b = defaultForeground
& fsPos .~ m
& fsRad .~ dist m a
& fsSPic .~ noPic (colorSH yellow $ thinHighBar 0 a' b')
where
m = midPoint a b
a' = a - m
b' = b - m
verticalWire :: Point2 -> Float -> Float -> ForegroundShape
verticalWire p h1 h2 = defaultForeground
& fsPos .~ p
& fsRad .~ 2
& fsSPic .~ noPic (colorSH yellow $ barPP 1.5 (V3 0 0 h1) (V3 0 0 h2))
putWireEnd :: Int -> (Point2,Float) -> Float -> Room -> Room
putWireEnd i (p,a) h = rmEndWires %~ IM.insert i (WallWire p a h)