Documentation ¶
Overview ¶
Package texturepacker reads sprite sheets created and exported as JSON by TexturePacker: https://www.codeandweb.com/texturepacker
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format interface {
SpriteSheetFrom(data []byte) (*SpriteSheet, error)
}
Format represents a generic parser for a sprite sheet data format.
type FormatJSONHash ¶
type FormatJSONHash struct{}
FormatJSONHash implements the Format interface and is a parser for the TexturePacker output data format "JSON (Hash)".
func (FormatJSONHash) SpriteSheetFrom ¶
func (f FormatJSONHash) SpriteSheetFrom(data []byte) (*SpriteSheet, error)
SpriteSheetFrom parses the given JSON data in the TexturePacker output data format "JSON (Hash)" and returns a sprite sheet.
type Metadata ¶
type Metadata struct { App string Version string Image string Format string Size image.Point Scale string SmartUpdate string }
The Metadata structure holds information about the sprite sheet image file and the application with which the sprite sheet was created.
type Sprite ¶
type Sprite struct { Frame image.Rectangle Rotated bool Trimmed bool SpriteSourceSize image.Rectangle SourceSize image.Point Pivot FloatPoint }
A Sprite is a rectangular area within a sprite sheet image.
type SpriteSheet ¶
A SpriteSheet is a collection of sprites packed into a single image. Each sprite has a name by which it can be looked up and a rectangular area within the sheet image. The sheet image file is referenced by its file name in the metadata structure.
func SheetFromData ¶
func SheetFromData(data []byte, f Format) (*SpriteSheet, error)
SheetFromData parses sprite sheet information from data with the specified format.
func SheetFromFile ¶
func SheetFromFile(path string, f Format) (*SpriteSheet, error)
SheetFromFile loads and parses sprite sheet information from a file with the specified format.