A background (a BGND entry): a picture GameMaker Studio 1 rooms draw behind or in
front of everything and cut tiles from, and, from GameMaker Studio 2, a tileset.
picture is the Cauldron2D.GameMaker.Region the picture comes from. A tileset also
has a tiles map:
size—{width, height}of one tileborder—{x, y}, the pixels between tiles on the pagecolumns— tiles across the picturecount— how many tiles there areframes— pictures per tile; above1a tile animates, one frame everyframe_timemicroseconds, throughids, which lists each tile's frames in turn
Tile n sits at column rem(n, columns) and row div(n, columns), each cell
size plus border twice, the picture starting border into the cell.
Summary
Functions
The background at at; format decides whether it carries a tileset.
Where tile id sits in the picture, as {x, y, width, height}.
Types
@type t() :: %Cauldron2D.GameMaker.Background{ name: String.t(), picture: Cauldron2D.GameMaker.Region.t() | nil, smooth: boolean(), tiles: tiles() | nil }
@type tiles() :: %{ size: {pos_integer(), pos_integer()}, border: {non_neg_integer(), non_neg_integer()}, columns: pos_integer(), count: non_neg_integer(), frames: pos_integer(), frame_time: non_neg_integer(), ids: [non_neg_integer()] }
Functions
@spec read( binary(), non_neg_integer(), %{required(non_neg_integer()) => Cauldron2D.GameMaker.Region.t()}, atom() ) :: t()
The background at at; format decides whether it carries a tileset.
@spec tile_source(t(), non_neg_integer()) :: {non_neg_integer(), non_neg_integer(), pos_integer(), pos_integer()}
Where tile id sits in the picture, as {x, y, width, height}.