sprites

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: Apache-2.0 Imports: 2 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 []Frame
	Name   string
	Loop   bool
	// contains filtered or unexported fields
}

func (*Animation) Done added in v0.0.2

func (a *Animation) Done() bool

func (*Animation) Image

func (a *Animation) Image() *ebiten.Image

func (*Animation) Reset

func (a *Animation) Reset()

func (*Animation) Update

func (a *Animation) Update(dt time.Duration)

type Frame

type Frame struct {
	Image    *ebiten.Image
	Duration time.Duration
	Width    int
	Height   int
}

type Shader

type Shader interface {
	Draw(srcImage *ebiten.Image, screen *ebiten.Image, op *ebiten.DrawRectShaderOptions)
	Update(dt time.Duration)
}

type Sprite

type Sprite struct {
	Shader Shader
	// contains filtered or unexported fields
}

func NewSprite

func NewSprite(sheet *SpriteSheet) *Sprite

func (*Sprite) Animation

func (s *Sprite) Animation() *Animation

func (*Sprite) Draw

func (s *Sprite) Draw(x float64, y float64, flipH bool, screen *ebiten.Image, colorScale ebiten.ColorScale)

func (*Sprite) SetAnimation

func (s *Sprite) SetAnimation(name string, loop bool)

func (*Sprite) SpriteSheet

func (s *Sprite) SpriteSheet() *SpriteSheet

func (*Sprite) Update

func (s *Sprite) Update(dt time.Duration)

type SpriteSheet

type SpriteSheet struct {
	Tags   []Tag
	Frames []Frame
}

func (*SpriteSheet) Add

func (s *SpriteSheet) Add(tag string, frames []Frame)

func (*SpriteSheet) Animation

func (s *SpriteSheet) Animation(tag string) *Animation

func (*SpriteSheet) FrameSize

func (s *SpriteSheet) FrameSize() (w, h int)

func (*SpriteSheet) TagByName

func (s *SpriteSheet) TagByName(tag string) *Tag

type Tag

type Tag struct {
	Name string
	From int
	To   int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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