Cauldron2D.GameMaker.Region (Cauldron2D.GameMaker v0.2.1)

Copy Markdown View Source

A picture's place on a texture page (a TPAG item).

source is the rectangle {x, y, width, height} cut from texture page page. target is where that rectangle lands, {x, y, width, height}, inside a picture of bounds {width, height}: GameMaker trims see-through margins off a picture before packing it, and target puts them back. A target narrower or shorter than the source means the page holds the picture scaled down.

Summary

Functions

The region at at.

Every region in the TPAG chunk at at, by its offset in the file.

Types

rectangle()

t()

@type t() :: %Cauldron2D.GameMaker.Region{
  bounds: {non_neg_integer(), non_neg_integer()},
  page: non_neg_integer(),
  source: rectangle(),
  target: rectangle()
}

Functions

read(data, at)

@spec read(binary(), non_neg_integer()) :: t()

The region at at.

read_all(data, at)

@spec read_all(binary(), non_neg_integer()) :: %{required(non_neg_integer()) => t()}

Every region in the TPAG chunk at at, by its offset in the file.