This module provides the means of producing a drawing of the reactor's world. The drawing is then rendered on canvas. Currently, only grid-based drawings are supported.
type Drawing = DrawingM Unit
DrawingM is usually too general; our drawing-contructing functions don't need to return
anything. Internal implementation detail.
Usually, constructing a drawing will look something like this.
drawTwoPoints :: CoordinateSystem Point -> CoordinateSystem Point -> Drawing drawTwoPoints blueXY redXY = do fill Color.blue400 $ tile blueXY fill Color.red400 $ tile redXY
newtype DrawingM a
A free monad for
DrawingF that enables you to use
do-notation when constructing drawings.
Just an internal implementation detail.
data DrawingF a
A DSL for constructing drawings. Currently, only filled shapes are supported.
DrawingF is for internal use.
You should construct a drawing by calling the different helper functions, like
fill, instead of
manually calling the
DrawingF data contructors.
drawGridWithIndex :: forall a. Grid a -> (Coordinates -> a -> Maybe Color) -> Drawing
A function almost identical to
drawGrid, only the function matching colors to grid cells
is provided with an index of the cell in addition to the value of the cell.
tile :: Coordinates -> Shape
A 1-square tile on the given point in the grid.