spine

package
v0.0.0-...-e1c21c9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Zlib Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoneYDown = false

Functions

This section is empty.

Types

type Animation

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

func NewAnimation

func NewAnimation(name string, timelines []Timeline, duration float32) *Animation

func (*Animation) Apply

func (a *Animation) Apply(skeleton *Skeleton, time float32, loop bool)

func (*Animation) Duration

func (a *Animation) Duration() float32

func (*Animation) Mix

func (a *Animation) Mix(skeleton *Skeleton, time float32, loop bool, alpha float32)

type Atlas

type Atlas struct {
	Pages   []*AtlasPage
	Regions []*AtlasRegion
	// contains filtered or unexported fields
}

func NewAtlas

func NewAtlas(r io.Reader, loader TextureLoader) (*Atlas, error)

func (*Atlas) Dispose

func (a *Atlas) Dispose() error

func (*Atlas) FindRegion

func (a *Atlas) FindRegion(name string) *AtlasRegion

* Returns the first region found with the specified name. This method uses string comparison to find the region, so the result * should be cached rather than calling this method multiple times. * @return The region, or null.

type AtlasAttachmentLoader

type AtlasAttachmentLoader struct {
	*Atlas
}

func (AtlasAttachmentLoader) NewAttachment

func (a AtlasAttachmentLoader) NewAttachment(skin *Skin, _type, name string) (Attachment, error)

type AtlasPage

type AtlasPage struct {
	Name           string
	Format         TextureFormat
	MinFilter      TextureFilter
	MagFilter      TextureFilter
	UWrap          TextureWrap
	VWrap          TextureWrap
	RendererObject interface{}
	Width, Height  int
}

type AtlasRegion

type AtlasRegion struct {
	Page                          *AtlasPage
	Name                          string
	X, Y, Width, Height           int
	U, V, U2, V2                  float32
	OffsetX, OffsetY              float32
	OriginalWidth, OriginalHeight int
	Index                         int
	Rotate                        bool
	Splits                        [4]int
	Pads                          [4]int
}

type Attachment

type Attachment interface {
	Name() string
}

type AttachmentLoader

type AttachmentLoader interface {
	NewAttachment(skin *Skin, _type, name string) (Attachment, error)
}

type AttachmentTimeline

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

func NewAttachmentTimeline

func NewAttachmentTimeline(l int) *AttachmentTimeline

func (*AttachmentTimeline) Apply

func (t *AttachmentTimeline) Apply(skeleton *Skeleton, time, alpha float32)

type Bone

type Bone struct {
	Data *BoneData

	X             float32
	Y             float32
	Rotation      float32
	ScaleX        float32
	ScaleY        float32
	M00           float32
	M01           float32
	M10           float32
	M11           float32
	WorldX        float32
	WorldY        float32
	WorldRotation float32
	WorldScaleX   float32
	WorldScaleY   float32
	// contains filtered or unexported fields
}

func NewBone

func NewBone(boneData *BoneData, parent *Bone) *Bone

func (*Bone) SetToSetupPose

func (b *Bone) SetToSetupPose()

func (*Bone) UpdateWorldTransform

func (b *Bone) UpdateWorldTransform(flipX, flipY bool)

type BoneData

type BoneData struct {
	Length float32
	// contains filtered or unexported fields
}

func NewBoneData

func NewBoneData(name string, parent *BoneData) *BoneData

type ColorTimeline

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

func NewColorTimeline

func NewColorTimeline(l int) *ColorTimeline

func (*ColorTimeline) Apply

func (t *ColorTimeline) Apply(skeleton *Skeleton, time, alpha float32)

type Curve

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

func NewCurve

func NewCurve(frameCount int) *Curve

func (*Curve) CurvePercent

func (c *Curve) CurvePercent(index int, percent float32) float32

func (*Curve) SetCurve

func (c *Curve) SetCurve(index int, cx1, cy1, cx2, cy2 float32)

func (*Curve) SetLinear

func (c *Curve) SetLinear(index int)

func (*Curve) SetStepped

func (c *Curve) SetStepped(index int)

type RegionAttachment

type RegionAttachment struct {
	X        float32
	Y        float32
	Rotation float32
	ScaleX   float32
	ScaleY   float32
	Width    float32
	Height   float32

	RendererObject       interface{}
	RegionOffsetX        float32
	RegionOffsetY        float32
	RegionWidth          float32
	RegionHeight         float32
	RegionOriginalWidth  float32
	RegionOriginalHeight float32

	Uvs [8]float32
	// contains filtered or unexported fields
}

func NewRegionAttachment

func NewRegionAttachment(name string) *RegionAttachment

func (RegionAttachment) Name

func (a RegionAttachment) Name() string

func (*RegionAttachment) SetUVs

func (r *RegionAttachment) SetUVs(u float32, v float32, u2 float32, v2 float32, rotate bool)

func (*RegionAttachment) Update

func (r *RegionAttachment) Update(slot *Slot) (verts [8]float32)

type RotateTimeline

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

func NewRotateTimeline

func NewRotateTimeline(l int) *RotateTimeline

func (*RotateTimeline) Apply

func (t *RotateTimeline) Apply(skeleton *Skeleton, time, alpha float32)

type ScaleTimeline

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

func NewScaleTimeline

func NewScaleTimeline(l int) *ScaleTimeline

func (*ScaleTimeline) Apply

func (t *ScaleTimeline) Apply(skeleton *Skeleton, time, alpha float32)

type Skeleton

type Skeleton struct {
	Bones     []*Bone
	Slots     []*Slot
	DrawOrder []*Slot

	X, Y float32

	FlipX, FlipY bool
	DebugBones   bool
	DebugSlots   bool
	// contains filtered or unexported fields
}

func NewSkeleton

func NewSkeleton(skeletonData *SkeletonData) *Skeleton

func (*Skeleton) AttachmentBySlotIndex

func (s *Skeleton) AttachmentBySlotIndex(index int, name string) Attachment

func (*Skeleton) AttachmentBySlotName

func (s *Skeleton) AttachmentBySlotName(slot string, attachment string) Attachment

func (*Skeleton) FindAnimation

func (s *Skeleton) FindAnimation(name string) *Animation

func (*Skeleton) FindBone

func (s *Skeleton) FindBone(name string) (int, *Bone)

func (*Skeleton) FindSlot

func (s *Skeleton) FindSlot(name string) (int, *Slot)

func (*Skeleton) RootBone

func (s *Skeleton) RootBone() *Bone

func (*Skeleton) SetAttachment

func (s *Skeleton) SetAttachment(slotName, attachmentName string)

func (*Skeleton) SetSkin

func (s *Skeleton) SetSkin(skin *Skin)

func (*Skeleton) SetSkinByName

func (s *Skeleton) SetSkinByName(name string)

func (*Skeleton) SetToSetupPose

func (s *Skeleton) SetToSetupPose()

func (*Skeleton) Update

func (s *Skeleton) Update(dt float32)

func (*Skeleton) UpdateWorldTransform

func (s *Skeleton) UpdateWorldTransform()

type SkeletonData

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

func New

func New(r io.Reader, scale float32, loader AttachmentLoader) (*SkeletonData, error)

func NewSkeletonData

func NewSkeletonData() *SkeletonData

type Skin

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

func NewSkin

func NewSkin(name string) *Skin

func (*Skin) AddAttachment

func (s *Skin) AddAttachment(slotIndex int, name string, attachment Attachment)

func (*Skin) Attachment

func (s *Skin) Attachment(slotIndex int, name string) Attachment

type Slot

type Slot struct {
	Bone       *Bone
	R, G, B, A float32

	Attachment Attachment
	// contains filtered or unexported fields
}

func NewSlot

func NewSlot(slotData *SlotData, skeleton *Skeleton, bone *Bone) *Slot

func (*Slot) AttachmentTime

func (s *Slot) AttachmentTime() float32

func (*Slot) SetAttachment

func (s *Slot) SetAttachment(attachment Attachment)

func (*Slot) SetAttachmentTime

func (s *Slot) SetAttachmentTime(time float32)

func (*Slot) SetToSetupPose

func (s *Slot) SetToSetupPose()

func (*Slot) Skeleton

func (s *Slot) Skeleton() *Skeleton

type SlotData

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

func NewSlotData

func NewSlotData(name string, boneData *BoneData) *SlotData

type TextureFilter

type TextureFilter int
const (
	Nearest TextureFilter = iota
	Linear
	MipMap
	MipMapNearestNearest
	MipMapLinearNearest
	MipMapNearestLinear
	MipMapLinearLinear
)

type TextureFormat

type TextureFormat int
const (
	Alpha TextureFormat = iota
	Intensity
	LuminanceAlpha
	RGB565
	RGBA4444
	RGB888
	RGBA8888
)

type TextureLoader

type TextureLoader interface {
	Load(page *AtlasPage) error
	Unload(page *AtlasPage) error
}

type TextureWrap

type TextureWrap int
const (
	MirroredRepeat TextureWrap = iota
	ClampToEdge
	Repeat
)

type Timeline

type Timeline interface {
	Apply(skeleton *Skeleton, time, alpha float32)
}

type TranslateTimeline

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

func NewTranslateTimeline

func NewTranslateTimeline(l int) *TranslateTimeline

func (*TranslateTimeline) Apply

func (t *TranslateTimeline) Apply(skeleton *Skeleton, time, alpha float32)

Jump to

Keyboard shortcuts

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