sprite

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

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

Editor allows for pixel-by-pixel modification of a Sprite

func NewEditor

func NewEditor(x, y int) *Editor

NewEditor creates an Editor at the desired location for the specified Sprite

func (*Editor) Bounds

func (e *Editor) Bounds() image.Rectangle

Bounds returns a Rectangle indicating the bounding box for the Editor

func (*Editor) Draw

func (e *Editor) Draw(screen *ebiten.Image)

Draw renders the Editor to a screen

func (*Editor) PreferredSize

func (e *Editor) PreferredSize() (sx, sy int)

PreferredSize returns the desired width and height of the Editor

func (*Editor) SetPosition

func (e *Editor) SetPosition(x, y int)

SetPosition changes the XY coordinate of the upper-left pixel

func (*Editor) SetSize

func (e *Editor) SetSize(sx, sy int)

SetSize changes the width and height of the Editor

func (*Editor) SetVisible

func (e *Editor) SetVisible(visible bool)

SetVisible changes the visibility of the Editor

func (*Editor) Update

func (e *Editor) Update() error

Update tells the internal Sprite to Update

type Preview

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

Preview provides an enlarged view of a Sprite

func NewPreview

func NewPreview(x, y int) *Preview

NewPreview creates a new Preview for the specified Palette

func (*Preview) Bounds

func (p *Preview) Bounds() image.Rectangle

Bounds returns a rectangle indicating the visible boundaries of the Preview

func (*Preview) Draw

func (p *Preview) Draw(screen *ebiten.Image)

Draw renders the Preview to a screen

func (*Preview) PreferredSize

func (p *Preview) PreferredSize() (sx, sy int)

PreferredSize calculates the desired width and height of the Preview

func (*Preview) SetPosition

func (p *Preview) SetPosition(x, y int)

SetPosition changes the XY coordinate of the upper-left pixel

func (*Preview) SetSize

func (p *Preview) SetSize(sx, sy int)

SetSize changes the width and height of the Preview

func (*Preview) SetVisible

func (p *Preview) SetVisible(visible bool)

SetVisible changes the visibility of the Preview

func (*Preview) Update

func (p *Preview) Update() error

Update checks for mouse clicks in the Preview (NOT IMPLEMENTED)

type Selector

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

Selector is a 2D grid of Sprites

func NewSelector

func NewSelector(x, y int) *Selector

NewSelector creates a Selector for the provided SpriteSet with the specified Palette

func (*Selector) Bounds

func (s *Selector) Bounds() image.Rectangle

Bounds returns a rectangle indicatign the visible boundaries of the Selector

func (*Selector) Draw

func (s *Selector) Draw(screen *ebiten.Image)

Draw renders the selector to the screen

func (*Selector) PreferredSize

func (s *Selector) PreferredSize() (sx, sy int)

PreferredSize calculates the desired width and height of the Selector

func (*Selector) SetPosition

func (s *Selector) SetPosition(x, y int)

SetPosition changes the XP coordinate of the upper-left pixel

func (*Selector) SetSize

func (s *Selector) SetSize(sx, sy int)

SetSize changes the width and height of the Selector

func (*Selector) SetVisible

func (s *Selector) SetVisible(visible bool)

SetVisible changes the visibility of the Selector

func (*Selector) Update

func (s *Selector) Update() error

Update checks if any Sprites are selected

type Sprite

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

Sprite represents a square sprite of pixels

func NewSprite

func NewSprite(img *model.Sprite, writable bool, scale int) *Sprite

NewSprite creates a new empty Sprite of the specified size, scale (multiplier), and color Palette

func (*Sprite) Bounds

func (s *Sprite) Bounds() image.Rectangle

Bounds returns a rectangle indicating the visible boundaries of the Sprite

func (*Sprite) Draw

func (s *Sprite) Draw(screen *ebiten.Image)

Draw renders the Sprite to a screen

func (*Sprite) PreferredSize

func (s *Sprite) PreferredSize() (int, int)

PreferredSize calculates the desired width and height of the Sprite

func (*Sprite) SetPosition

func (s *Sprite) SetPosition(x, y int)

SetPosition changes the XY coordinate of the upper-left pixel

func (*Sprite) SetSize

func (s *Sprite) SetSize(sx, sy int)

SetSize changes the width and height of the Sprite

func (*Sprite) SetVisible

func (s *Sprite) SetVisible(visible bool)

SetVisible changes the visibility of the Sprite

func (*Sprite) Swap

func (s *Sprite) Swap(src *model.Sprite) (prev *model.Sprite)

Swap changes out the Image for this sprite with another

func (*Sprite) Update

func (s *Sprite) Update() error

Update detects a mouse click inside a sprite, changing the color according to the button pressed

Jump to

Keyboard shortcuts

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