Cauldron2D.Parallax.Panorama (Cauldron2D v0.2.2)

Copy Markdown View Source

A layer that is one picture, repeated.

Cauldron2D.Parallax.Panorama.layer(
  name: :mountains,
  art: :mountains,
  size: {20, 12},
  at: {0, 6},
  wrap: :x,
  factor: {0.2, 0.05}
)

art is one art of the atlas, size is how many tiles it covers, and at is where its top-left corner sits in the layer's own tiles. wrap repeats it along :x, :y, :both or :none, laying down as many copies as the pane needs.

Every other option is Cauldron2D.Parallax.Layer.new/1's. The picture is copied into the pane rather than drawn tile by tile, so a layer of this kind costs no blending.

Summary

Functions

A layer drawing art across the pane.

Where copies of a picture period tiles long must sit to cover extent from origin.

Types

picture()

@type picture() :: %{
  art: term(),
  size: {pos_integer(), pos_integer()},
  wrap: wrap(),
  at: {integer(), integer()}
}

wrap()

@type wrap() :: :x | :y | :both | :none

Functions

layer(opts)

@spec layer(keyword()) :: Cauldron2D.Parallax.Layer.t()

A layer drawing art across the pane.

places(bool, origin, extent, period, at)

@spec places(boolean(), integer(), integer(), pos_integer(), integer()) :: [integer()]

Where copies of a picture period tiles long must sit to cover extent from origin.

render(atlas, picture, arg1, arg2, tile, scale, at, void)

@spec render(
  Cauldron2D.Atlas.t(),
  picture(),
  {integer(), integer()},
  {pos_integer(), pos_integer()},
  pos_integer(),
  pos_integer(),
  integer(),
  :opaque | :transparent
) :: FrenchCurve.Raster.t()

The picture laid across a pane.

origin is the layer's top-left tile, target the pane's pixel size, tile the pixels a tile covers at this scale, and void what fills the pane where no copy reaches.