Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByWidthAndHeight ¶
type ByWidthAndHeight []*Sprite
ByWidthAndHeight implements sort.Interface based on the Width and Height field.
func (ByWidthAndHeight) Len ¶
func (a ByWidthAndHeight) Len() int
func (ByWidthAndHeight) Less ¶
func (a ByWidthAndHeight) Less(i, j int) bool
func (ByWidthAndHeight) Swap ¶
func (a ByWidthAndHeight) Swap(i, j int)
type Sprite ¶
type Sprite struct { ID string `json:"key"` X int `json:"x"` Y int `json:"y"` W int `json:"w"` H int `json:"h"` // contains filtered or unexported fields }
Sprite describes a frame in the spritesheet.
type Spritesheet ¶
type Spritesheet struct { Sprites []*Sprite `json:"frames"` Width int `json:"width"` Height int `json:"height"` }
Spritesheet describes a tileset.
func FromImageList ¶
func FromImageList(images []string) (Spritesheet, error)
FromImageList builds a Spritesheet filled will the specified images slice.
func (*Spritesheet) Image ¶
func (ss *Spritesheet) Image() (image.Image, error)
Image assembles the spritesheet image.
func (*Spritesheet) JSON ¶
func (ss *Spritesheet) JSON() (string, error)
JSON encodes the spritesheet metadata.
func (*Spritesheet) Len ¶
func (ss *Spritesheet) Len() int
Len returns the number of blocks in total.
func (*Spritesheet) Place ¶
func (ss *Spritesheet) Place(n, x, y int)
Place places the block n, at the position [x, y].
func (*Spritesheet) Size ¶
func (ss *Spritesheet) Size(n int) (width, height int)
Size returns the width and height of the block n.
Directories ¶
Path | Synopsis |
---|---|
Package binpack implements Jake Gordon's 2D binpacking algorithm.
|
Package binpack implements Jake Gordon's 2D binpacking algorithm. |
cmd
|
|
Click to show internal directories.
Click to hide internal directories.