Cauldron2D.Atlas.Manifest (Cauldron2D v0.1.3)

Copy Markdown View Source

The atlas.txt beside an art directory's pictures: what a text renderer draws for each art, and how fast its frames go.

wall    #   #5a7cf0 
flame   f   #ff7000 12
flame_blue  f   #3070ff 12  from flame; colour F #3070ff

One art a line, tab-separated: the name, the glyph (two columns), the colour as #rrggbb, the frames a second, and, for an art made from another, its derivation as Linocut.Derive reads it; an empty field leaves that setting to the picture. Cauldron2D.Atlas.load/3 reads it as the defaults under its :arts, and builds the derived arts after the pictures.

Summary

Functions

The manifest's entries as Cauldron2D.Atlas.load/3's :arts, with arts laid over them.

The derived arts, name and derivation, in name order.

The manifest's file name.

The entries the text holds.

The manifest in dir, empty when there is none.

The manifest as text.

Write the manifest to dir, one art a line in name order.

Types

entry()

@type entry() :: %{
  optional(:glyph) => String.t(),
  optional(:color) => {byte(), byte(), byte()},
  optional(:fps) => pos_integer(),
  optional(:derive) => String.t()
}

t()

@type t() :: %{required(atom()) => entry()}

Functions

arts(manifest, arts)

@spec arts(t(), keyword()) :: keyword()

The manifest's entries as Cauldron2D.Atlas.load/3's :arts, with arts laid over them.

derived(manifest)

@spec derived(t()) :: [{atom(), String.t()}]

The derived arts, name and derivation, in name order.

file_name()

@spec file_name() :: String.t()

The manifest's file name.

parse(text)

@spec parse(String.t()) :: t()

The entries the text holds.

read(dir)

@spec read(Path.t()) :: t()

The manifest in dir, empty when there is none.

render(manifest)

@spec render(t()) :: String.t()

The manifest as text.

write(dir, manifest)

@spec write(Path.t(), t()) :: :ok | {:error, term()}

Write the manifest to dir, one art a line in name order.