This commit is contained in:
2022-07-28 12:35:19 +01:00
parent 160560af5f
commit 8aeabf3f6c
16 changed files with 123 additions and 365 deletions
+30 -8
View File
@@ -1,19 +1,25 @@
module Dodge.Machine.Draw
where
import Dodge.Placement.Instance.Sensor
import Dodge.Placement.Instance.Turret
import Dodge.Placement.TopDecoration
--import Dodge.Placement.Instance.Turret
import Shape
import Picture
import Geometry
import Dodge.Data.Machine
import ShapePicture
drawMachine :: MachineDraw -> Machine -> SPic
drawMachine md = case md of
MachineDrawMempty -> const mempty
MachineDrawTerminal -> terminalSPic
MachineDrawTurret -> drawTurret
MachineDrawDamageSensor w pcds -> sensorSPic w pcds
drawMachine :: Machine -> SPic
drawMachine mc = case _mcType mc of
McStatic -> mempty
McTerminal -> terminalSPic mc
McTurret tu -> drawTurret tu mc
McSensor se -> drawSensor se mc
drawSensor :: Sensor -> Machine -> SPic
drawSensor sens = case sens of
DamageSensor {_sensDraw = pcds} -> sensorSPic pcds
ProximitySensor {} -> const mempty
terminalSPic :: Machine -> SPic
terminalSPic = noPic . terminalShape
@@ -31,3 +37,19 @@ terminalShape mc = colorSH col (prismPoly
where
col = _mcColor mc
drawTurret :: Turret -> Machine -> SPic
drawTurret _ mc =
( rotateSH (- _mcDir mc) . colorSH (_mcColor mc) $ upperPrismPoly 20 (square w)
, mempty -- setLayer 5 $ scale 0.5 0.5 $ text $ show $ _mcDir mc )
)
where
w = _mcWidth mc
sensorSPic :: (PaletteColor, DecorationShape) -> Machine -> SPic
sensorSPic (pc, ds) mc =
noPic $
colorSH (_mcColor mc) (upperPrismPoly 25 (square w))
<> decorationToShape ds w w 25 col col
where
col = paletteToColor pc
w = _mcWidth mc