struct Atlas

type Atlas* = struct {
	i: image::Image // source image
	cs: th::Vf2 // size of a cell in pixels
	dm: th::Vf2 // amount of cells in image
}

Atlas is an image containing tiles in a square grid.

fn mk

fn mk*(i: image::Image, dm: th::Vf2): Atlas {

i: source image dm: amount of cells

fn Atlas.coords

fn (a: ^Atlas) coords*(n: int): (th::Vf2, std::Err) {

returns the coordinates of the nth tile

fn Atlas.cropSource

fn (a: ^Atlas) cropSource*(at: th::Vf2): std::Err {

Crops the sourse image to only show a wanted tile

enum PackStrategy

const (
	PackSquare* = 0
	PackRow*
	PackColumn*
)

fn pack

fn pack*(images: []image::Image, strategy: int): (Atlas, std::Err) {

Packs an array of images into an atlas

fn Atlas.draw

fn (a: ^Atlas) draw*(at: th::Vf2, t: th::Transform): std::Err {

Draws the tile at at