Skip to content

package sprite

import "kaiju/systems/visual2d/sprite"

Variables

ZAxisScaleFactor

float32(16.0)

Functions

ReadSpriteSheetData

func ReadSpriteSheetData(jsonStr string) (spriteSheet, error)

Types

ShaderData

struct

type ShaderData struct {
    rendering.ShaderDataBase
    UVs     matrix.Vec4
    FgColor matrix.Color
}

ShaderData.Size

func (t ShaderData) Size() int

Sprite

struct

type Sprite struct {
    Entity *engine.Entity

    // Has unexported fields.
}

NewSprite

func NewSprite(x, y, width, height matrix.Float,

host engine.Host, texture rendering.Texture, color matrix.Color) *Sprite

NewSpriteFlipBook

func NewSpriteFlipBook(x, y, width, height float32,

host engine.Host, images []rendering.Texture, fps float32) *Sprite

NewSpriteSheet

func NewSpriteSheet(x, y, width, height float32,

host engine.Host, texture rendering.Texture, jsonStr string, fps float32, initialClip string) *Sprite

Sprite.Activate

func (s *Sprite) Activate()

Sprite.CurrentClipName

func (s Sprite) CurrentClipName() string

Sprite.Deactivate

func (s *Sprite) Deactivate()

Sprite.Move

func (s *Sprite) Move(x, y matrix.Float)

Sprite.Move3D

func (s *Sprite) Move3D(x, y, z matrix.Float)

Sprite.PlayAnimation

func (s *Sprite) PlayAnimation()

Sprite.Position

func (s *Sprite) Position() matrix.Vec2

Sprite.Resize

func (s *Sprite) Resize(width, height matrix.Float)

Sprite.SetColor

func (s *Sprite) SetColor(color matrix.Color)

Sprite.SetFlipBookAnimation

func (s *Sprite) SetFlipBookAnimation(

framesPerSecond float32, textures ...*rendering.Texture)

Sprite.SetFrameRate

func (s *Sprite) SetFrameRate(framesPerSecond float32)

Sprite.SetPosition

func (s *Sprite) SetPosition(x, y matrix.Float)

Sprite.SetPosition3D

func (s *Sprite) SetPosition3D(x, y, z matrix.Float)

Sprite.SetSheetClip

func (s *Sprite) SetSheetClip(clipName string)

Sprite.SetTexture

func (s *Sprite) SetTexture(texture *rendering.Texture)

Sprite.StopAnimation

func (s *Sprite) StopAnimation()