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 {

returns the coordinates of the nth tile

fn Atlas.cropSource

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

Crops the sourse image to only show a wanted tile

fn Atlas.draw

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

Draws the tile at at