sprite

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageTypePNG  = "png"
	ImageTypeJPEG = "jpeg"
	ImageTypeJPG  = "jpg"
)
View Source
const (
	LinkSepID    = "#"
	LinkSepPoint = ":"
)
View Source
const SheetSchemaStr = `` /* 852-byte string literal not displayed */

Variables

This section is empty.

Functions

func NewSheetType added in v0.3.0

func NewSheetType() (resource.Type, error)

func Types

func Types() []resource.Type

Types

type IDLink struct {
	SpriteSheetRef, SpriteID string
}

func (*IDLink) FindSprite added in v0.3.0

func (l *IDLink) FindSprite(mgr resource.Manager) (*Sprite, bool)

func (*IDLink) String added in v0.3.0

func (l *IDLink) String() string

type Image

type Image struct {
	Image *ebiten.Image
}

func LoadImage

func LoadImage(path string) (*Image, error)

func (*Image) Initialize

func (img *Image) Initialize(mgr resource.Manager) error

type ImageType

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

func (*ImageType) Load

func (t *ImageType) Load(path string) (resource.Resource, error)

func (*ImageType) Name

func (t *ImageType) Name() string
type Link interface {
	FindSprite(mgr resource.Manager) (*Sprite, bool)
}
func ParseLink(link string) (l Link, err error)
type PointLink struct {
	SpriteSheetRef string
	Origin         topdown.Point[int]
}

func (*PointLink) FindSprite added in v0.3.0

func (l *PointLink) FindSprite(mgr resource.Manager) (*Sprite, bool)

func (*PointLink) String added in v0.3.0

func (l *PointLink) String() string

type Sheet added in v0.3.0

type Sheet struct {
	ImageRef string    `json:"imageRef"`
	Sprites  []*Sprite `json:"sprites"`
}

func NewSheet added in v0.3.0

func NewSheet(imageRef string, sprites ...*Sprite) *Sheet

func (*Sheet) FindSpriteByID added in v0.3.0

func (s *Sheet) FindSpriteByID(id string) (*Sprite, bool)

func (*Sheet) FindSpriteByOrigin added in v0.3.0

func (s *Sheet) FindSpriteByOrigin(origin topdown.Point[int]) (*Sprite, bool)

func (*Sheet) Initialize added in v0.3.0

func (s *Sheet) Initialize(mgr resource.Manager) error

func (*Sheet) Tags added in v0.3.0

func (s *Sheet) Tags() []string

type SheetType added in v0.3.0

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

func (*SheetType) Load added in v0.3.0

func (pt *SheetType) Load(path string) (resource.Resource, error)

func (*SheetType) Name added in v0.3.0

func (pt *SheetType) Name() string

type Sprite

type Sprite struct {
	ID     string             `json:"id"`
	Origin topdown.Point[int] `json:"origin"`
	Size   topdown.Size[int]  `json:"size"`
	Tags   []string           `json:"tags,omitempty"`

	Image *ebiten.Image
}

func (*Sprite) Initialize

func (c *Sprite) Initialize(parent *ebiten.Image)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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