sprite

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 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 Element

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

Element represents a UI Element element. It contains animation data

func New

func New(name string, scene string, x float64, y float64, width int, height int, tintColor color.Color, img *common.Image) (*Element, error)

New creates a new element

func (*Element) AnimationName

func (e *Element) AnimationName() string

AnimationName returns the current played animation name

func (*Element) BundleIndex

func (e *Element) BundleIndex() int

BundleIndex returns the index sprite rendering

func (*Element) CellHeight

func (e *Element) CellHeight() int

CellHeight returns an element's animation cell height

func (*Element) CellWidth

func (e *Element) CellWidth() int

CellWidth returns an element's animation cell width

func (*Element) Draw

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

Draw is called during a game update

func (*Element) Height

func (e *Element) Height() int

Height returns an element's height

func (*Element) IsAnimated

func (e *Element) IsAnimated() bool

IsAnimated returns true if the element is considered an animation

func (*Element) IsDestroyed

func (e *Element) IsDestroyed() bool

IsDestroyed returns true when the element is flagged for deletion

func (*Element) IsEnabled

func (e *Element) IsEnabled() bool

IsEnabled returns true if a element is enabled

func (*Element) IsVisible

func (e *Element) IsVisible() bool

IsVisible returns true if mob is visible

func (*Element) LerpPosition

func (e *Element) LerpPosition(endPositionX, endPositionY float64, duration time.Duration, isDestroyed bool, endFunc func())

LerpPosition changes an element's position over duration

func (*Element) Name

func (e *Element) Name() string

Name returns a mob's name

func (*Element) RenderIndex

func (e *Element) RenderIndex() int64

RenderIndex returns the render index of element

func (*Element) Scale

func (e *Element) Scale() float64

Scale returns the scale of a element. default 1

func (*Element) SetAnimation

func (e *Element) SetAnimation(anim common.Animation) error

SetAnimation sets animation data

func (*Element) SetAnimationName

func (e *Element) SetAnimationName(name string)

SetAnimationName sets the current animation group name

func (*Element) SetBundleIndex

func (e *Element) SetBundleIndex(index int) error

SetBundleIndex sets which version of sprite bundle to render

func (*Element) SetEnabled

func (e *Element) SetEnabled(isEnabled bool)

SetEnabled changes if a element is enabled

func (*Element) SetHeight

func (e *Element) SetHeight(height int)

SetHeight sets an element's height

func (*Element) SetIsAnimated

func (e *Element) SetIsAnimated(isAnimated bool)

SetIsAnimated flags if the animation information should be honored or not

func (*Element) SetIsDestroyed

func (e *Element) SetIsDestroyed(isDestroyed bool)

SetIsDestroyed sets an element to be destroyed on next update

func (*Element) SetOnPressFunction

func (e *Element) SetOnPressFunction(f func())

SetOnPressFunction lets you pass a function without the need of element handling

func (*Element) SetOnPressed

func (e *Element) SetOnPressed(f func(e *Element))

SetOnPressed sets a element state

func (*Element) SetPosition

func (e *Element) SetPosition(x float64, y float64)

SetPosition sets an element's position

func (*Element) SetRenderIndex

func (e *Element) SetRenderIndex(renderIndex int64)

SetRenderIndex sets the render index of element

func (*Element) SetScale

func (e *Element) SetScale(scale float64)

SetScale sets the scale of a element

func (*Element) SetText

func (e *Element) SetText(text string)

SetText changes the text on the element

func (*Element) SetVisible

func (e *Element) SetVisible(isVisible bool)

SetVisible changes the visibility of a element

func (*Element) SetWidth

func (e *Element) SetWidth(width int)

SetWidth sets an element's width

func (*Element) Update

func (e *Element) Update(dt float64)

Update is called during a game update

func (*Element) Width

func (e *Element) Width() int

Width returns an element's width

Jump to

Keyboard shortcuts

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