tileset

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tile

type Tile struct {
	ID   string `yaml:"id"`
	MinX int    `yaml:"minX"`
	MinY int    `yaml:"minY"`
	MaxX int    `yaml:"maxX"`
	MaxY int    `yaml:"maxY"`
}

Tile describes a tile in the tiles set.

func (*Tile) Rect

func (t *Tile) Rect() image.Rectangle

Rect returns the image rectangle fot the tile.

type Tileset

type Tileset struct {
	Tiles  []*Tile `yaml:"tiles,omitempty"`
	Width  int     `yaml:"width"`
	Height int     `yaml:"height"`
	Data   string  `yaml:"data"`
	// contains filtered or unexported fields
}

Tileset describes a tile set.

func Load

func Load(uri ...string) ([]*Tileset, error)

Load fetches an array of tileset(s).

func (*Tileset) Get

func (ts *Tileset) Get(id string) (Tile, bool)

Get returns the tile with the specified id.

func (*Tileset) Image

func (ts *Tileset) Image(tile Tile) (image.Image, error)

Image returns the tile image.

func (*Tileset) List

func (ts *Tileset) List(wr io.Writer) error

List writers all the tiles id on the specified writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL