Cauldron2D.Projection.Glyphs (Cauldron2D v0.2.2)

Copy Markdown View Source

A projection drawn as one of the atlas's two-character glyphs per slot.

Cauldron2D.Projection.Glyphs.compose(:my_game, Cauldron2D.Projection.Iso,
  focus: {12.5, 8.5},
  cell: &MyGame.cell/1,
  size: {320, 200},
  step: {32, 32},
  facing: 1,
  facings: 4
)

module must answer ground_map/2: Cauldron2D.Projection.Iso or Cauldron2D.Projection.Oblique. Every option except :step is that projection's own, and :size is the picture in pixels it would draw.

:step is {across, down}, the pixels of that picture one slot covers, so the grid is div(width, across) slots wide and div(height, down) tall. A slot takes the glyph and colour of the cell at the world point the projection shows at its middle, the last standing art where a cell has any, as Cauldron2D.Camera.glyphs/2 chooses them. Movers and labels are drawn over that, each at the slot it projects into.

Returns rows of {glyph, colour}.

Summary

Functions

The grid, as the module documentation describes.

Types

slot()

@type slot() :: {String.t(), {byte(), byte(), byte()}}

Functions

compose(atlas, module, opts)

@spec compose(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), module(), keyword()) ::
  [[slot()]]

The grid, as the module documentation describes.