glitchasset

package
v0.0.0-...-ef5f187 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	Frames map[string][]AnimationFrame
	// contains filtered or unexported fields
}

TODO - Assumes that all animations share the same spritesheet

type AnimationFrame

type AnimationFrame struct {
	Name     string
	Sprite   *glitch.Sprite
	Duration time.Duration
	MirrorY  bool
}

type AseFrame

type AseFrame struct {
	Filename string `json:filename`
	//Frame todo
	Duration int `json:duration`
}

type AseFrameTag

type AseFrameTag struct {
	Name      string `json:name`
	From      int    `json:from`
	To        int    `json:to`
	Direction string `json:direction`
}

type AseMeta

type AseMeta struct {
	FrameTags []AseFrameTag `json:frameTags`
}

type AseSheet

type AseSheet struct {
	Frames []AseFrame `json:frames`
	Meta   AseMeta
}

TODO - move Aseprite stuff to another package?

type Load

type Load struct {
	// contains filtered or unexported fields
}

func NewLoad

func NewLoad(filesystem fs.FS) *Load

func (*Load) AseAnimation

func (load *Load) AseAnimation(spritesheet *Spritesheet, filepath string) (*Animation, error)

TODO - Assumptions: frame name is <filename>-<framenumber>.png (Aseprite doesn't export the file name. But you could maybe repack their spritesheet into your own)

func (*Load) AseSheet

func (load *Load) AseSheet(filepath string) (*AseSheet, error)

Loads an aseprite spritesheet.

func (*Load) Data

func (load *Load) Data(filepath string) ([]byte, error)

func (*Load) Font

func (load *Load) Font(filepath string, size float64) (font.Face, error)

func (*Load) Image

func (load *Load) Image(filepath string) (image.Image, error)

func (*Load) Json

func (load *Load) Json(filepath string, dat interface{}) error

func (*Load) Mountpoints

func (load *Load) Mountpoints(filepath string) (packer.MountFrames, error)

func (*Load) Open

func (load *Load) Open(filepath string) (fs.File, error)

func (*Load) Sprite

func (load *Load) Sprite(filepath string, smooth bool) (*glitch.Sprite, error)

Loads a single sprite from a filepath of an image

func (*Load) Spritesheet

func (load *Load) Spritesheet(filepath string, smooth bool) (*Spritesheet, error)

func (*Load) Texture

func (load *Load) Texture(filepath string, smooth bool) (*glitch.Texture, error)

func (*Load) Yaml

func (load *Load) Yaml(filepath string, dat interface{}) error

type Spritesheet

type Spritesheet struct {
	// contains filtered or unexported fields
}

func NewSpritesheet

func NewSpritesheet(tex *glitch.Texture, lookup map[string]*glitch.Sprite) *Spritesheet

func (*Spritesheet) Get

func (s *Spritesheet) Get(name string) (*glitch.Sprite, error)

func (*Spritesheet) Picture

func (s *Spritesheet) Picture() *glitch.Texture

Jump to

Keyboard shortcuts

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