Reactor.Graphics.Drawing
- Package
- purescript-grid-reactors
- Repository
- Eugleo/purescript-grid-reactors
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.
#Drawing Source
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
#DrawingM Source
newtype DrawingM a
A free monad for DrawingF
that enables you to use do
-notation when constructing drawings.
Just an internal implementation detail.
Constructors
Instances
#DrawingF Source
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.
Constructors
Instances
#drawGridWithIndex Source
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 Source
tile :: Coordinates -> Shape
A 1-square tile on the given point in the grid.