Documentation
¶
Overview ¶
Package core contains lower level component systems.
Index ¶
- Constants
- Variables
- func Clamp(x, min, max float64) float64
- func DrawLayerSystemExec(ctx Context)
- func FindWithTag(w *ecs.World, tag string, tags ...string) []ecs.Entity
- func NewWorld(e Engine) *ecs.World
- func RegisterComponentSystem(cs ComponentSystem)
- func RotationTransformSystemExec(ctx Context)
- func SetupSystem(w *ecs.World, cs ComponentSystem)
- func SpriteAnimationLinkSystemExec(ctx Context)
- func SpriteAnimationSystemExec(ctx Context)
- func StartDefaults(e Engine)
- func TagSystemExec(ctx Context)
- func TransformSpriteSystemExec(ctx Context)
- func TransformSystemExec(ctx Context)
- func UpsertComponent(w *ecs.World, comp ecs.NewComponentInput) *ecs.Component
- type AfterDrawFuncComponentSystem
- func (cs *AfterDrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *AfterDrawFuncComponentSystem) SystemExec() SystemExecFn
- func (cs *AfterDrawFuncComponentSystem) SystemName() string
- func (cs *AfterDrawFuncComponentSystem) SystemPriority() int
- func (cs *AfterDrawFuncComponentSystem) SystemTags() []string
- type AfterFuncComponentSystem
- type AnimClipMode
- type Animation
- type AnimationClip
- type AnimationEvent
- type AnimationEventFn
- type AnimationEventID
- type AnimationEventListeners
- func (ae *AnimationEventListeners) Add(name string, fn AnimationEventFn) AnimationEventID
- func (ae *AnimationEventListeners) AddCatchAll(fn AnimationEventFn) AnimationEventID
- func (ae *AnimationEventListeners) Clear()
- func (ae *AnimationEventListeners) Dispatch(name, value string)
- func (ae *AnimationEventListeners) Remove(id AnimationEventID) bool
- type BaseComponentSystem
- type BasicCS
- func (cs *BasicCS) BasicCS() int
- func (cs *BasicCS) Components(w *ecs.World) []*ecs.Component
- func (cs *BasicCS) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *BasicCS) SystemExec() SystemExecFn
- func (cs *BasicCS) SystemInit() SystemInitFn
- func (cs *BasicCS) SystemName() string
- func (cs *BasicCS) SystemPriority() int
- func (cs *BasicCS) SystemTags() []string
- type BeforeDrawFuncComponentSystem
- func (cs *BeforeDrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *BeforeDrawFuncComponentSystem) SystemExec() SystemExecFn
- func (cs *BeforeDrawFuncComponentSystem) SystemName() string
- func (cs *BeforeDrawFuncComponentSystem) SystemPriority() int
- func (cs *BeforeDrawFuncComponentSystem) SystemTags() []string
- type BeforeFuncComponentSystem
- type ColorMatrix
- type ComponentSystem
- type Context
- type DrawFn
- type DrawFunc
- type DrawFuncComponentSystem
- func (cs *DrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *DrawFuncComponentSystem) SystemExec() SystemExecFn
- func (cs *DrawFuncComponentSystem) SystemName() string
- func (cs *DrawFuncComponentSystem) SystemPriority() int
- func (cs *DrawFuncComponentSystem) SystemTags() []string
- type DrawLayer
- type DrawLayerComponentSystem
- func (cs *DrawLayerComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *DrawLayerComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *DrawLayerComponentSystem) SystemExec() SystemExecFn
- func (cs *DrawLayerComponentSystem) SystemInit() SystemInitFn
- func (cs *DrawLayerComponentSystem) SystemName() string
- func (cs *DrawLayerComponentSystem) SystemPriority() int
- type DrawLayerDrawableComponentSystem
- func (cs *DrawLayerDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *DrawLayerDrawableComponentSystem) SystemExec() SystemExecFn
- func (cs *DrawLayerDrawableComponentSystem) SystemInit() SystemInitFn
- func (cs *DrawLayerDrawableComponentSystem) SystemName() string
- func (cs *DrawLayerDrawableComponentSystem) SystemPriority() int
- func (cs *DrawLayerDrawableComponentSystem) SystemTags() []string
- type DrawManager
- type Drawable
- type DrawableImager
- type Engine
- type EntitySet
- type EntitySortedList
- func (sl *EntitySortedList) AddOrUpdate(key ecs.Entity, value SLVal) bool
- func (sl *EntitySortedList) Delete(key ecs.Entity) bool
- func (sl *EntitySortedList) Each(fn func(key ecs.Entity, value SLVal) bool)
- func (sl *EntitySortedList) FirstValue() SLVal
- func (sl *EntitySortedList) Get(key ecs.Entity) (SLVal, bool)
- func (sl *EntitySortedList) LastValue() SLVal
- func (sl *EntitySortedList) Reset()
- type Event
- type EventFn
- type EventID
- type EventManager
- type Func
- type FuncComponentSystem
- type GeoMatrix
- type Label
- func (l *Label) ClearTransformMatrix()
- func (l *Label) ComputedSize() image.Point
- func (l *Label) Destroy()
- func (l *Label) Draw(renderer DrawManager)
- func (l *Label) FontFaceHeight() int
- func (l *Label) IsDisabled() bool
- func (l *Label) ResetTextOffset()
- func (l *Label) SetDirty()
- func (l *Label) SetOffset(x, y float64)
- func (l *Label) SetTransformMatrix(m GeoMatrix)
- func (l *Label) Size() (w, h float64)
- func (l *Label) Update(ctx Context)
- type LayerIndex
- type LayerTuple
- type Middleware
- type Observer
- type PcAnimClip
- func (c PcAnimClip) GetEndedEvent() *AnimationEvent
- func (c PcAnimClip) GetEvents() []*AnimationEvent
- func (c PcAnimClip) GetFPS() float64
- func (c PcAnimClip) GetFrameCount() int
- func (c PcAnimClip) GetImage(frame int) *ebiten.Image
- func (c PcAnimClip) GetMode() AnimClipMode
- func (c PcAnimClip) GetName() string
- func (c PcAnimClip) GetOffset(frame int) (x, y float64)
- func (c PcAnimClip) GetRect(frame int) image.Rectangle
- type PcFrame
- type PrecomputedAnimation
- func (a *PrecomputedAnimation) Count() int
- func (a *PrecomputedAnimation) Each(fn func(i int, clip AnimationClip) bool)
- func (a *PrecomputedAnimation) GetClip(index int) AnimationClip
- func (a *PrecomputedAnimation) GetClipEvents(index int) []*AnimationEvent
- func (a *PrecomputedAnimation) GetClipImage(clipi, frame int) *ebiten.Image
- func (a *PrecomputedAnimation) GetClipOffset(clipi, frame int) (x, y float64)
- func (a *PrecomputedAnimation) GetClipRect(clipi, frame int) image.Rectangle
- type Rotation
- type RotationTransformComponentSystem
- func (cs *RotationTransformComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *RotationTransformComponentSystem) SystemExec() SystemExecFn
- func (cs *RotationTransformComponentSystem) SystemInit() SystemInitFn
- func (cs *RotationTransformComponentSystem) SystemName() string
- func (cs *RotationTransformComponentSystem) SystemPriority() int
- type SLVal
- type SetBase
- type SoloDrawableComponentSystem
- func (cs *SoloDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *SoloDrawableComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *SoloDrawableComponentSystem) SystemExec() SystemExecFn
- func (cs *SoloDrawableComponentSystem) SystemInit() SystemInitFn
- func (cs *SoloDrawableComponentSystem) SystemName() string
- func (cs *SoloDrawableComponentSystem) SystemPriority() int
- func (cs *SoloDrawableComponentSystem) SystemTags() []string
- type Sprite
- func (s *Sprite) ClearColorTransform()
- func (s *Sprite) ClearTransformMatrix()
- func (s *Sprite) Destroy()
- func (s *Sprite) Draw(renderer DrawManager)
- func (s *Sprite) GetImage() *ebiten.Image
- func (s *Sprite) GetPrecomputedImage() *ebiten.Image
- func (s *Sprite) GetPrecomputedImageDim() (width, height float64)
- func (s *Sprite) IsDisabled() bool
- func (s *Sprite) SetColorHue(theta float64)
- func (s *Sprite) SetColorTint(c color.Color)
- func (s *Sprite) SetCompositeMode(mode ebiten.CompositeMode)
- func (s *Sprite) SetImage(img *ebiten.Image)
- func (s *Sprite) SetOffset(x, y float64)
- func (s *Sprite) SetTransformMatrix(m GeoMatrix)
- func (s *Sprite) Size() (w, h float64)
- func (s *Sprite) Update(ctx Context)
- type SpriteAnimation
- type SpriteAnimationComponentSystem
- func (cs *SpriteAnimationComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *SpriteAnimationComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *SpriteAnimationComponentSystem) SystemExec() SystemExecFn
- func (cs *SpriteAnimationComponentSystem) SystemName() string
- func (cs *SpriteAnimationComponentSystem) SystemPriority() int
- func (cs *SpriteAnimationComponentSystem) SystemTags() []string
- type SpriteAnimationLinkComponentSystem
- func (cs *SpriteAnimationLinkComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *SpriteAnimationLinkComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *SpriteAnimationLinkComponentSystem) SystemExec() SystemExecFn
- func (cs *SpriteAnimationLinkComponentSystem) SystemName() string
- func (cs *SpriteAnimationLinkComponentSystem) SystemPriority() int
- func (cs *SpriteAnimationLinkComponentSystem) SystemTags() []string
- type SystemExecFn
- type SystemInitFn
- type Tag
- type TagComponentSystem
- func (cs *TagComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *TagComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *TagComponentSystem) SystemExec() SystemExecFn
- func (cs *TagComponentSystem) SystemInit() SystemInitFn
- func (cs *TagComponentSystem) SystemName() string
- type TileSet
- func (t *TileSet) ClearTransformMatrix()
- func (t *TileSet) Destroy()
- func (t *TileSet) Draw(renderer DrawManager)
- func (t *TileSet) IsDisabled() bool
- func (t *TileSet) SetOffset(x, y float64)
- func (t *TileSet) SetTransformMatrix(m GeoMatrix)
- func (t *TileSet) Size() (w, h float64)
- func (t *TileSet) Update(ctx Context)
- type TiledAnimation
- func (a *TiledAnimation) Count() int
- func (a *TiledAnimation) Each(fn func(i int, clip AnimationClip) bool)
- func (a *TiledAnimation) GetClip(index int) AnimationClip
- func (a *TiledAnimation) GetClipEvents(index int) []*AnimationEvent
- func (a *TiledAnimation) GetClipImage(clipi, frame int) *ebiten.Image
- func (a *TiledAnimation) GetClipOffset(clipi, frame int) (x, y float64)
- func (a *TiledAnimation) GetClipRect(clipi, frame int) image.Rectangle
- type TiledAnimationClip
- func (c TiledAnimationClip) GetEndedEvent() *AnimationEvent
- func (c TiledAnimationClip) GetEvents() []*AnimationEvent
- func (c TiledAnimationClip) GetFPS() float64
- func (c TiledAnimationClip) GetFrameCount() int
- func (c TiledAnimationClip) GetImage(frame int) *ebiten.Image
- func (c TiledAnimationClip) GetMode() AnimClipMode
- func (c TiledAnimationClip) GetName() string
- func (c TiledAnimationClip) GetOffset(frame int) (x, y float64)
- func (c TiledAnimationClip) GetRect(frame int) image.Rectangle
- type Transform
- type TransformComponentSystem
- func (cs *TransformComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *TransformComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *TransformComponentSystem) SystemExec() SystemExecFn
- func (cs *TransformComponentSystem) SystemInit() SystemInitFn
- func (cs *TransformComponentSystem) SystemName() string
- func (cs *TransformComponentSystem) SystemPriority() int
- type TransformDrawableComponentSystem
- func (cs *TransformDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
- func (cs *TransformDrawableComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
- func (cs *TransformDrawableComponentSystem) SystemExec() SystemExecFn
- func (cs *TransformDrawableComponentSystem) SystemInit() SystemInitFn
- func (cs *TransformDrawableComponentSystem) SystemName() string
- func (cs *TransformDrawableComponentSystem) SystemPriority() int
- type UpdateFn
Constants ¶
const ( // SNSoloDrawable is the system name of a drawable without as DrawLayer component SNSoloDrawable = "primen.DrawableSystem" // SNDrawLayerDrawable is the system name of a drawable with as DrawLayer component SNDrawLayerDrawable = "primen.DrawLayerDrawableSystem" // CNDrawable is the component name of a drawable CNDrawable = "primen.DrawableComponent" )
const ( CNDrawFunc = "tau/core.DrawFuncComponent" SNDrawFunc = "tau/core.DrawFuncSystem" SNDrawFuncAfter = "tau/core.DrawFuncAfterSystem" SNDrawFuncBefore = "tau/core.DrawFuncBeforeSystem" )
const ( // SNDrawLayer is the system name SNDrawLayer = "primen.DrawLayerSystem" // CNDrawLayer is the component signature name CNDrawLayer = "primen.DrawLayerComponent" // SNDrawLayerSprite is the system name SNDrawLayerSprite = "primen.DrawLayerSpriteSystem" )
const ( // ZIndexTop is to set the ZIndex at the top ZIndexTop = int64(math.MinInt64) // ZIndexBottom is to set the ZIndex at the bottom ZIndexBottom = int64(math.MinInt64 + 1) )
const ( SNTag = "primen.TagSystem" CNTag = "primen.TagComponent" )
const ( CNFunc = "tau/core.FuncComponent" SNFunc = "tau/core.FuncSystem" SNFuncAfter = "tau/core.FuncAfterSystem" SNFuncBefore = "tau/core.FuncBeforeSystem" )
const ( SNRotationTransform = "primen.RotationTransformSystem" CNRotation = "primen.RotationComponent" )
const ( SNSpriteAnimation = "primen.SpriteAnimationSystem" SNSpriteAnimationLink = "primen.SpriteAnimationLinkSystem" CNSpriteAnimation = "primen.SpriteAnimationComponent" )
const ( SNTransform = "primen.TransformSystem" SNTransformSprite = "primen.TransformSpriteSystem" CNTransform = "primen.TransformComponent" )
const ( // DefaultImageOptions key passed to the default world (&ebiten.DrawImageOptions{}) DefaultImageOptions string = "default_image_options" )
Variables ¶
var ( // DebugDraw enables to see debug lines and stats DebugDraw = false )
Functions ¶
func Clamp ¶
Clamp returns x clamped to the interval [min, max].
If x is less than min, min is returned. If x is more than max, max is returned. Otherwise, x is returned.
func DrawLayerSystemExec ¶
func DrawLayerSystemExec(ctx Context)
DrawLayerSystemExec is the main function of the DrawLayerSystem
func RegisterComponentSystem ¶
func RegisterComponentSystem(cs ComponentSystem)
func RotationTransformSystemExec ¶
func RotationTransformSystemExec(ctx Context)
RotationTransformSystemExec is the main function of the RotationTransformSystem
func SetupSystem ¶
func SetupSystem(w *ecs.World, cs ComponentSystem)
func SpriteAnimationLinkSystemExec ¶
func SpriteAnimationLinkSystemExec(ctx Context)
SpriteAnimationLinkSystemExec is what glues the animation and sprite together
func SpriteAnimationSystemExec ¶
func SpriteAnimationSystemExec(ctx Context)
SpriteAnimationSystemExec is the main function of the SpriteSystem
func StartDefaults ¶
func StartDefaults(e Engine)
func TagSystemExec ¶
func TagSystemExec(ctx Context)
TagSystemExec is the main function of the TagSystem
func TransformSpriteSystemExec ¶
func TransformSpriteSystemExec(ctx Context)
TransformSpriteSystemExec is the main function of the TransformSpriteSystem
func TransformSystemExec ¶
func TransformSystemExec(ctx Context)
TransformSystemExec is the main function of the TransformSystem
func UpsertComponent ¶
Types ¶
type AfterDrawFuncComponentSystem ¶ added in v0.3.0
type AfterDrawFuncComponentSystem struct {
BaseComponentSystem
}
func (*AfterDrawFuncComponentSystem) Components ¶ added in v0.3.0
func (cs *AfterDrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*AfterDrawFuncComponentSystem) SystemExec ¶ added in v0.3.0
func (cs *AfterDrawFuncComponentSystem) SystemExec() SystemExecFn
SystemExec returns the exec func
func (*AfterDrawFuncComponentSystem) SystemName ¶ added in v0.3.0
func (cs *AfterDrawFuncComponentSystem) SystemName() string
SystemName returns the system name
func (*AfterDrawFuncComponentSystem) SystemPriority ¶ added in v0.3.0
func (cs *AfterDrawFuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
func (*AfterDrawFuncComponentSystem) SystemTags ¶ added in v0.3.0
func (cs *AfterDrawFuncComponentSystem) SystemTags() []string
type AfterFuncComponentSystem ¶
type AfterFuncComponentSystem struct {
BaseComponentSystem
}
func (*AfterFuncComponentSystem) Components ¶
func (cs *AfterFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*AfterFuncComponentSystem) SystemExec ¶
func (cs *AfterFuncComponentSystem) SystemExec() SystemExecFn
SystemExec returns the exec func
func (*AfterFuncComponentSystem) SystemName ¶
func (cs *AfterFuncComponentSystem) SystemName() string
SystemName returns the system name
func (*AfterFuncComponentSystem) SystemPriority ¶
func (cs *AfterFuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
type AnimClipMode ¶
type AnimClipMode byte
AnimClipMode determines how time is treated outside of the keyframed range of an animation clip.
const ( // AnimOnce - When time reaches the end of the animation clip, the clip will automatically // stop playing and time will be reset to beginning of the clip. AnimOnce AnimClipMode = 0 // AnimLoop - When time reaches the end of the animation clip, time will continue at the beginning. AnimLoop AnimClipMode = 1 // AnimPingPong - When time reaches the end of the animation clip, time will ping pong back between beginning // and end. AnimPingPong AnimClipMode = 2 // AnimClampForever - Plays back the animation. When it reaches the end, it will keep playing the last frame // and never stop playing. // // When playing backwards it will reach the first frame and will keep playing that. This is useful for code // that uses the Playing bool to avoid activating said trigger. AnimClampForever AnimClipMode = 3 )
type Animation ¶ added in v0.3.0
type Animation interface {
Each(fn func(i int, clip AnimationClip) bool)
GetClip(index int) AnimationClip
GetClipEvents(index int) []*AnimationEvent
GetClipImage(clipindex, frame int) *ebiten.Image
GetClipRect(clipindex, frame int) image.Rectangle
GetClipOffset(clipindex, frame int) (x, y float64)
Count() int
}
Animation is a shared container of clips (reusable)
type AnimationClip ¶ added in v0.3.0
type AnimationClip interface {
GetName() string
GetFPS() float64
GetImage(frame int) *ebiten.Image
GetFrameCount() int
GetMode() AnimClipMode
GetEndedEvent() *AnimationEvent
GetEvents() []*AnimationEvent
GetRect(frame int) image.Rectangle
GetOffset(frame int) (x, y float64)
}
AnimationClip is the data os an animation clip (reusable)
type AnimationEvent ¶ added in v0.3.0
AnimationEvent holds a name and value to pass to listeners when the event is triggered
type AnimationEventFn ¶
type AnimationEventFn func(name, value string)
AnimationEventFn is a valid AnimationEvent function
type AnimationEventID ¶
type AnimationEventID int64
AnimationEventID is the id oa an animation listener instance
type AnimationEventListeners ¶
type AnimationEventListeners struct {
// contains filtered or unexported fields
}
AnimationEventListeners groups AnimationEvent listeners
func (*AnimationEventListeners) Add ¶
func (ae *AnimationEventListeners) Add(name string, fn AnimationEventFn) AnimationEventID
Add a new listener
func (*AnimationEventListeners) AddCatchAll ¶
func (ae *AnimationEventListeners) AddCatchAll(fn AnimationEventFn) AnimationEventID
AddCatchAll adds a wildcard listener
func (*AnimationEventListeners) Clear ¶
func (ae *AnimationEventListeners) Clear()
Clear removes all event listeners
func (*AnimationEventListeners) Dispatch ¶
func (ae *AnimationEventListeners) Dispatch(name, value string)
Dispatch triggers all compatible listeners with the event
func (*AnimationEventListeners) Remove ¶
func (ae *AnimationEventListeners) Remove(id AnimationEventID) bool
Remove a listener by ID
type BaseComponentSystem ¶
type BaseComponentSystem struct {
}
func (*BaseComponentSystem) ExcludeComponents ¶
func (cs *BaseComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*BaseComponentSystem) SystemExec ¶
func (cs *BaseComponentSystem) SystemExec() SystemExecFn
func (*BaseComponentSystem) SystemInit ¶
func (cs *BaseComponentSystem) SystemInit() SystemInitFn
func (*BaseComponentSystem) SystemPriority ¶
func (cs *BaseComponentSystem) SystemPriority() int
func (*BaseComponentSystem) SystemTags ¶
func (cs *BaseComponentSystem) SystemTags() []string
type BasicCS ¶
type BasicCS struct {
SysName string
SysPriority int
SysInit SystemInitFn
SysExec SystemExecFn
SysTags []string
GetComponents func(w *ecs.World) []*ecs.Component
}
func (*BasicCS) ExcludeComponents ¶
func (*BasicCS) SystemExec ¶
func (cs *BasicCS) SystemExec() SystemExecFn
func (*BasicCS) SystemInit ¶
func (cs *BasicCS) SystemInit() SystemInitFn
func (*BasicCS) SystemName ¶
func (*BasicCS) SystemPriority ¶
func (*BasicCS) SystemTags ¶
type BeforeDrawFuncComponentSystem ¶ added in v0.3.0
type BeforeDrawFuncComponentSystem struct {
BaseComponentSystem
}
func (*BeforeDrawFuncComponentSystem) Components ¶ added in v0.3.0
func (cs *BeforeDrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*BeforeDrawFuncComponentSystem) SystemExec ¶ added in v0.3.0
func (cs *BeforeDrawFuncComponentSystem) SystemExec() SystemExecFn
SystemExec returns the exec func
func (*BeforeDrawFuncComponentSystem) SystemName ¶ added in v0.3.0
func (cs *BeforeDrawFuncComponentSystem) SystemName() string
SystemName returns the system name
func (*BeforeDrawFuncComponentSystem) SystemPriority ¶ added in v0.3.0
func (cs *BeforeDrawFuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
func (*BeforeDrawFuncComponentSystem) SystemTags ¶ added in v0.3.0
func (cs *BeforeDrawFuncComponentSystem) SystemTags() []string
type BeforeFuncComponentSystem ¶
type BeforeFuncComponentSystem struct {
BaseComponentSystem
}
func (*BeforeFuncComponentSystem) Components ¶
func (cs *BeforeFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*BeforeFuncComponentSystem) SystemExec ¶
func (cs *BeforeFuncComponentSystem) SystemExec() SystemExecFn
SystemExec returns the exec func
func (*BeforeFuncComponentSystem) SystemName ¶
func (cs *BeforeFuncComponentSystem) SystemName() string
SystemName returns the system name
func (*BeforeFuncComponentSystem) SystemPriority ¶
func (cs *BeforeFuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
type ColorMatrix ¶ added in v0.4.0
type ColorMatrix interface {
Reset() ColorMatrix
M() *ebiten.ColorM
MV() ebiten.ColorM
RotateHue(theta float64) ColorMatrix
ChangeHSV(hueTheta float64, saturationScale float64, valueScale float64) ColorMatrix
Apply(clr color.Color) ColorMatrix
}
func ColorM ¶ added in v0.4.0
func ColorM() ColorMatrix
func ColorM2 ¶ added in v0.4.0
func ColorM2(m ebiten.ColorM) ColorMatrix
func ColorTint ¶ added in v0.4.0
func ColorTint(c color.Color) ColorMatrix
type ComponentSystem ¶
type Context ¶
type Context interface {
ecs.Context
Engine() Engine
FPS() float64
Frame() int64
IsDrawingSkipped() bool
Renderer() DrawManager
}
Context is the context passed to every system update function.
type DrawFuncComponentSystem ¶ added in v0.3.0
type DrawFuncComponentSystem struct {
BaseComponentSystem
}
func (*DrawFuncComponentSystem) Components ¶ added in v0.3.0
func (cs *DrawFuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*DrawFuncComponentSystem) SystemExec ¶ added in v0.3.0
func (cs *DrawFuncComponentSystem) SystemExec() SystemExecFn
func (*DrawFuncComponentSystem) SystemName ¶ added in v0.3.0
func (cs *DrawFuncComponentSystem) SystemName() string
SystemName returns the system name
func (*DrawFuncComponentSystem) SystemPriority ¶ added in v0.3.0
func (cs *DrawFuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
func (*DrawFuncComponentSystem) SystemTags ¶ added in v0.3.0
func (cs *DrawFuncComponentSystem) SystemTags() []string
type DrawLayer ¶
type DrawLayer struct {
Layer LayerIndex
ZIndex int64
// contains filtered or unexported fields
}
DrawLayer component data
type DrawLayerComponentSystem ¶
type DrawLayerComponentSystem struct {
BaseComponentSystem
}
DrawLayerComponentSystem component system
func (*DrawLayerComponentSystem) Components ¶
func (cs *DrawLayerComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*DrawLayerComponentSystem) ExcludeComponents ¶
func (cs *DrawLayerComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
ExcludeComponents returns the components that must not be present in this system
func (*DrawLayerComponentSystem) SystemExec ¶
func (cs *DrawLayerComponentSystem) SystemExec() SystemExecFn
SystemExec returns the system exec fn
func (*DrawLayerComponentSystem) SystemInit ¶
func (cs *DrawLayerComponentSystem) SystemInit() SystemInitFn
SystemInit returns the system init
func (*DrawLayerComponentSystem) SystemName ¶
func (cs *DrawLayerComponentSystem) SystemName() string
SystemName returns the system name
func (*DrawLayerComponentSystem) SystemPriority ¶
func (cs *DrawLayerComponentSystem) SystemPriority() int
SystemPriority returns the system priority
type DrawLayerDrawableComponentSystem ¶
type DrawLayerDrawableComponentSystem struct {
BaseComponentSystem
}
DrawLayerDrawableComponentSystem handles drawables with a draw layer
func (*DrawLayerDrawableComponentSystem) Components ¶
func (cs *DrawLayerDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*DrawLayerDrawableComponentSystem) SystemExec ¶
func (cs *DrawLayerDrawableComponentSystem) SystemExec() SystemExecFn
SystemExec returns the system exec fn
func (*DrawLayerDrawableComponentSystem) SystemInit ¶
func (cs *DrawLayerDrawableComponentSystem) SystemInit() SystemInitFn
SystemInit returns the system init
func (*DrawLayerDrawableComponentSystem) SystemName ¶
func (cs *DrawLayerDrawableComponentSystem) SystemName() string
SystemName returns the system name
func (*DrawLayerDrawableComponentSystem) SystemPriority ¶
func (cs *DrawLayerDrawableComponentSystem) SystemPriority() int
SystemPriority returns the system priority
func (*DrawLayerDrawableComponentSystem) SystemTags ¶
func (cs *DrawLayerDrawableComponentSystem) SystemTags() []string
type DrawManager ¶ added in v0.4.0
type DrawManager interface {
DrawImageXY(image *ebiten.Image, x, y float64)
DrawImage(image *ebiten.Image, m GeoMatrix)
DrawImageC(image *ebiten.Image, m GeoMatrix, c ColorMatrix)
DrawImageComp(image *ebiten.Image, m GeoMatrix, mode ebiten.CompositeMode)
DrawImageCComp(image *ebiten.Image, m GeoMatrix, c ColorMatrix, mode ebiten.CompositeMode)
DrawImageRaw(image *ebiten.Image, opt *ebiten.DrawImageOptions)
Screen() *ebiten.Image
}
type Drawable ¶
type Drawable interface {
Update(ctx Context)
Draw(m DrawManager)
Destroy()
IsDisabled() bool
Size() (w, h float64)
SetTransformMatrix(m GeoMatrix)
ClearTransformMatrix()
SetOffset(x, y float64)
}
Drawable is the basis of all ebiten drawable items (sprites, texts, shapes)
type DrawableImager ¶
DrawableImager is a Drawable with Get and Set image funcs
type Engine ¶
type Engine interface {
AddWorld(w *ecs.World, priority int)
RemoveWorld(w *ecs.World) bool
Default() *ecs.World
Run() error
Ready() <-chan struct{}
Get(key string) interface{}
Set(key string, value interface{})
UpdateFrame() int64
DrawFrame() int64
Width() int
Height() int
AddEventListener(eventName string, fn EventFn) EventID
RemoveEventListener(id EventID) bool
DispatchEvent(eventName string, data interface{})
}
type EntitySet ¶
type EntitySet interface {
Add(elements ...ecs.Entity)
Remove(elements ...ecs.Entity)
Contains(elements ...ecs.Entity) bool
Values() []ecs.Entity
SetBase
}
func NewEntitySet ¶
NewEntitySet instantiates a new empty set and adds the entities (if present)
type EntitySortedList ¶
type EntitySortedList struct {
// contains filtered or unexported fields
}
func NewEntitySortedList ¶
func NewEntitySortedList(mincap int) *EntitySortedList
func (*EntitySortedList) AddOrUpdate ¶
func (sl *EntitySortedList) AddOrUpdate(key ecs.Entity, value SLVal) bool
func (*EntitySortedList) Each ¶
func (sl *EntitySortedList) Each(fn func(key ecs.Entity, value SLVal) bool)
Each iterates on all entries, sorted.
Do not delete or add entries while looping (it is read locked while looping).
func (*EntitySortedList) FirstValue ¶
func (sl *EntitySortedList) FirstValue() SLVal
func (*EntitySortedList) LastValue ¶
func (sl *EntitySortedList) LastValue() SLVal
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
func (*EventManager) Deregister ¶
func (m *EventManager) Deregister(id EventID) bool
func (*EventManager) Dispatch ¶
func (m *EventManager) Dispatch(eventName string, engine Engine, data interface{})
type FuncComponentSystem ¶
type FuncComponentSystem struct {
BaseComponentSystem
}
func (*FuncComponentSystem) Components ¶
func (cs *FuncComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*FuncComponentSystem) SystemExec ¶
func (cs *FuncComponentSystem) SystemExec() SystemExecFn
func (*FuncComponentSystem) SystemName ¶
func (cs *FuncComponentSystem) SystemName() string
SystemName returns the system name
func (*FuncComponentSystem) SystemPriority ¶
func (cs *FuncComponentSystem) SystemPriority() int
SystemPriority returns the system priority
type GeoMatrix ¶ added in v0.4.0
type Label ¶ added in v0.3.0
type Label struct {
Text string
Face font.Face
Area image.Point
Color color.Color
Filter ebiten.Filter
DrawDisabled bool // if true, the DrawableSystem will not draw this
//
X float64 // logical X position
Y float64 // logical Y position
Angle float64 // radians
ScaleX float64 // logical X scale (1 = 100%)
ScaleY float64 // logical Y scale (1 = 100%)
OriginX float64 // X origin (0 = left; 0.5 = center; 1 = right)
OriginY float64 // Y origin (0 = top; 0.5 = middle; 1 = bottom)
OffsetX float64 // Text rendering offset X (pixel unit)
OffsetY float64 // Text rendering offset Y (pixel unit)
FaceOffsetX int // Text rendering offset X (pixel unit)
FaceOffsetY int // Text rendering offset Y (pixel unit)
// contains filtered or unexported fields
}
func (*Label) ClearTransformMatrix ¶ added in v0.3.0
func (l *Label) ClearTransformMatrix()
func (*Label) ComputedSize ¶ added in v0.3.0
func (*Label) Draw ¶ added in v0.3.0
func (l *Label) Draw(renderer DrawManager)
Draw is called by the Drawable systems
func (*Label) FontFaceHeight ¶ added in v0.3.0
FontFaceHeight returns the font height
func (*Label) IsDisabled ¶ added in v0.3.0
func (*Label) ResetTextOffset ¶ added in v0.3.0
func (l *Label) ResetTextOffset()
ResetTextOffset sets the text offset to default (0, l.FontFaceHeight())
func (*Label) SetTransformMatrix ¶ added in v0.3.0
SetTransformMatrix is used by TransformSystem to set a custom transform
type LayerTuple ¶
type LayerTuple struct {
Index LayerIndex
Items *EntitySortedList
}
LayerTuple is returned when fetching all layers
type Middleware ¶
type Middleware func(next SystemExecFn) SystemExecFn
Middleware is a system middleware
func MidSkipFrames ¶
func MidSkipFrames(n int) Middleware
MidSkipFrames is a System middleware that skips n frames and then executes the next function in the system function stack
type PcAnimClip ¶ added in v0.3.0
type PcAnimClip struct {
// The name of an animation is not allowed to be changed during runtime
// but since this is part of a component (and components shouldn't have logic),
// it is a public member.
Name string
Frames []PcFrame
Events []*AnimationEvent //TODO: link
Fps float64
ClipMode AnimClipMode
EndedEvent *AnimationEvent //TODO: link
}
PcAnimClip is a pre-computed animation clip.
func (PcAnimClip) GetEndedEvent ¶ added in v0.3.0
func (c PcAnimClip) GetEndedEvent() *AnimationEvent
func (PcAnimClip) GetEvents ¶ added in v0.3.0
func (c PcAnimClip) GetEvents() []*AnimationEvent
func (PcAnimClip) GetFPS ¶ added in v0.3.0
func (c PcAnimClip) GetFPS() float64
func (PcAnimClip) GetFrameCount ¶ added in v0.3.0
func (c PcAnimClip) GetFrameCount() int
func (PcAnimClip) GetMode ¶ added in v0.3.0
func (c PcAnimClip) GetMode() AnimClipMode
func (PcAnimClip) GetName ¶ added in v0.3.0
func (c PcAnimClip) GetName() string
GetName returns the animation clip name
func (PcAnimClip) GetOffset ¶ added in v0.3.0
func (c PcAnimClip) GetOffset(frame int) (x, y float64)
GetOffset returns the pixel offset (from the origin) of the current frame
type PrecomputedAnimation ¶ added in v0.3.0
type PrecomputedAnimation struct {
Clips []PcAnimClip
}
PrecomputedAnimation is an animation of a one or more image sources It is the default data structure of an Atlas
func (*PrecomputedAnimation) Count ¶ added in v0.3.0
func (a *PrecomputedAnimation) Count() int
Count returns the total count of cnimation clips
func (*PrecomputedAnimation) Each ¶ added in v0.3.0
func (a *PrecomputedAnimation) Each(fn func(i int, clip AnimationClip) bool)
Each iterates through all animation clips
func (*PrecomputedAnimation) GetClip ¶ added in v0.3.0
func (a *PrecomputedAnimation) GetClip(index int) AnimationClip
GetClip returns an animation clip by index
func (*PrecomputedAnimation) GetClipEvents ¶ added in v0.3.0
func (a *PrecomputedAnimation) GetClipEvents(index int) []*AnimationEvent
GetClipEvents returns all animation clip events by the clip index
func (*PrecomputedAnimation) GetClipImage ¶ added in v0.3.0
func (a *PrecomputedAnimation) GetClipImage(clipi, frame int) *ebiten.Image
GetClipImage returns the clip image
func (*PrecomputedAnimation) GetClipOffset ¶ added in v0.3.0
func (a *PrecomputedAnimation) GetClipOffset(clipi, frame int) (x, y float64)
GetClipOffset returns the clip offset
func (*PrecomputedAnimation) GetClipRect ¶ added in v0.3.0
func (a *PrecomputedAnimation) GetClipRect(clipi, frame int) image.Rectangle
GetClipRect returns the clip Rectangle (bounds)
type RotationTransformComponentSystem ¶
type RotationTransformComponentSystem struct {
BaseComponentSystem
}
func (*RotationTransformComponentSystem) Components ¶
func (cs *RotationTransformComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*RotationTransformComponentSystem) SystemExec ¶
func (cs *RotationTransformComponentSystem) SystemExec() SystemExecFn
func (*RotationTransformComponentSystem) SystemInit ¶
func (cs *RotationTransformComponentSystem) SystemInit() SystemInitFn
func (*RotationTransformComponentSystem) SystemName ¶
func (cs *RotationTransformComponentSystem) SystemName() string
func (*RotationTransformComponentSystem) SystemPriority ¶
func (cs *RotationTransformComponentSystem) SystemPriority() int
type SoloDrawableComponentSystem ¶
type SoloDrawableComponentSystem struct {
BaseComponentSystem
}
SoloDrawableComponentSystem handles drawable items (without a draw layer)
func (*SoloDrawableComponentSystem) Components ¶
func (cs *SoloDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
Components returns the component signature(s)
func (*SoloDrawableComponentSystem) ExcludeComponents ¶
func (cs *SoloDrawableComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
ExcludeComponents returns the components that must not be present in this system
func (*SoloDrawableComponentSystem) SystemExec ¶
func (cs *SoloDrawableComponentSystem) SystemExec() SystemExecFn
SystemExec returns the system exec fn
func (*SoloDrawableComponentSystem) SystemInit ¶
func (cs *SoloDrawableComponentSystem) SystemInit() SystemInitFn
SystemInit returns the system init
func (*SoloDrawableComponentSystem) SystemName ¶
func (cs *SoloDrawableComponentSystem) SystemName() string
SystemName returns the system name
func (*SoloDrawableComponentSystem) SystemPriority ¶
func (cs *SoloDrawableComponentSystem) SystemPriority() int
SystemPriority returns the system priority
func (*SoloDrawableComponentSystem) SystemTags ¶
func (cs *SoloDrawableComponentSystem) SystemTags() []string
SystemTags -> draw
type Sprite ¶
type Sprite struct {
X float64 // logical X position
Y float64 // logical Y position
Angle float64 // radians
ScaleX float64 // logical X scale (1 = 100%)
ScaleY float64 // logical Y scale (1 = 100%)
OriginX float64 // X origin (0 = left; 0.5 = center; 1 = right)
OriginY float64 // Y origin (0 = top; 0.5 = middle; 1 = bottom)
OffsetX float64 // offset origin X (in pixels)
OffsetY float64 // offset origin Y (in pixels)
Image *ebiten.Image
DrawDisabled bool // if true, the SpriteSystem will not draw this
// contains filtered or unexported fields
}
Sprite is the data of a sprite component.
func (*Sprite) ClearColorTransform ¶ added in v0.4.0
func (s *Sprite) ClearColorTransform()
func (*Sprite) ClearTransformMatrix ¶
func (s *Sprite) ClearTransformMatrix()
func (*Sprite) Draw ¶
func (s *Sprite) Draw(renderer DrawManager)
Draw is called by the Drawable systems
func (*Sprite) GetPrecomputedImage ¶
GetPrecomputedImage returns the last precomputed image
TODO: remove
func (*Sprite) GetPrecomputedImageDim ¶
GetPrecomputedImageDim returns the last precomputed image dimmensions
func (*Sprite) IsDisabled ¶
func (*Sprite) SetColorHue ¶ added in v0.4.0
func (*Sprite) SetColorTint ¶ added in v0.4.0
func (*Sprite) SetCompositeMode ¶ added in v0.4.0
func (s *Sprite) SetCompositeMode(mode ebiten.CompositeMode)
func (*Sprite) SetTransformMatrix ¶
SetTransformMatrix is used by TransformSystem to set a custom transform
type SpriteAnimation ¶
type SpriteAnimation struct {
Enabled bool
Playing bool
ActiveClip int
ActiveFrame int
Anim Animation
T float64
// Default fps for clips with no fps specified
Fps float64
// contains filtered or unexported fields
}
SpriteAnimation holds the data of a sprite animation (and clips)
func (*SpriteAnimation) AnimEvent ¶
func (a *SpriteAnimation) AnimEvent(name, value string)
func (*SpriteAnimation) PlayClip ¶
func (a *SpriteAnimation) PlayClip(name string)
PlayClip sets the animation to play a clip by name
func (*SpriteAnimation) PlayClipIndex ¶ added in v0.3.0
func (a *SpriteAnimation) PlayClipIndex(i int)
PlayClipIndex plays a clip at index i
type SpriteAnimationComponentSystem ¶
type SpriteAnimationComponentSystem struct {
BaseComponentSystem
}
func (*SpriteAnimationComponentSystem) Components ¶
func (cs *SpriteAnimationComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*SpriteAnimationComponentSystem) ExcludeComponents ¶
func (cs *SpriteAnimationComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*SpriteAnimationComponentSystem) SystemExec ¶
func (cs *SpriteAnimationComponentSystem) SystemExec() SystemExecFn
func (*SpriteAnimationComponentSystem) SystemName ¶
func (cs *SpriteAnimationComponentSystem) SystemName() string
func (*SpriteAnimationComponentSystem) SystemPriority ¶
func (cs *SpriteAnimationComponentSystem) SystemPriority() int
func (*SpriteAnimationComponentSystem) SystemTags ¶
func (cs *SpriteAnimationComponentSystem) SystemTags() []string
type SpriteAnimationLinkComponentSystem ¶
type SpriteAnimationLinkComponentSystem struct {
BaseComponentSystem
}
func (*SpriteAnimationLinkComponentSystem) Components ¶
func (cs *SpriteAnimationLinkComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*SpriteAnimationLinkComponentSystem) ExcludeComponents ¶
func (cs *SpriteAnimationLinkComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*SpriteAnimationLinkComponentSystem) SystemExec ¶
func (cs *SpriteAnimationLinkComponentSystem) SystemExec() SystemExecFn
func (*SpriteAnimationLinkComponentSystem) SystemName ¶
func (cs *SpriteAnimationLinkComponentSystem) SystemName() string
func (*SpriteAnimationLinkComponentSystem) SystemPriority ¶
func (cs *SpriteAnimationLinkComponentSystem) SystemPriority() int
func (*SpriteAnimationLinkComponentSystem) SystemTags ¶
func (cs *SpriteAnimationLinkComponentSystem) SystemTags() []string
type SystemExecFn ¶
type SystemExecFn func(ctx Context)
func SystemWrap ¶
func SystemWrap(fn SystemExecFn, mid ...Middleware) SystemExecFn
SystemWrap wraps middlewares into a SystemExecFn
type Tag ¶
type Tag struct {
// public and private struct fields
Tags []string
Dirty bool
// contains filtered or unexported fields
}
Tag is the data of a tag component.
type TagComponentSystem ¶
type TagComponentSystem struct {
BaseComponentSystem
}
var (
TagCS *TagComponentSystem = new(TagComponentSystem)
)
func (*TagComponentSystem) Components ¶
func (cs *TagComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*TagComponentSystem) ExcludeComponents ¶
func (cs *TagComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*TagComponentSystem) SystemExec ¶
func (cs *TagComponentSystem) SystemExec() SystemExecFn
func (*TagComponentSystem) SystemInit ¶
func (cs *TagComponentSystem) SystemInit() SystemInitFn
func (*TagComponentSystem) SystemName ¶
func (cs *TagComponentSystem) SystemName() string
type TileSet ¶ added in v0.4.0
type TileSet struct {
X float64 // logical X position
Y float64 // logical Y position
Angle float64 // radians
ScaleX float64 // logical X scale (1 = 100%)
ScaleY float64 // logical Y scale (1 = 100%)
OriginX float64 // X origin (0 = left; 0.5 = center; 1 = right)
OriginY float64 // Y origin (0 = top; 0.5 = middle; 1 = bottom)
OffsetX float64 // offset origin X (in pixels)
OffsetY float64 // offset origin Y (in pixels)
DrawDisabled bool // if true, the DrawableSystem will not draw this
DB []*ebiten.Image
CellWidth float64
CellHeight float64
CSize image.Point
Cells []int
// contains filtered or unexported fields
}
TileSet is a drawable that efficiently draws tiles in a 2d array
func (*TileSet) ClearTransformMatrix ¶ added in v0.4.0
func (t *TileSet) ClearTransformMatrix()
ClearTransformMatrix Drawable implementation
func (*TileSet) Destroy ¶ added in v0.4.0
func (t *TileSet) Destroy()
Destroy Drawable implementation
func (*TileSet) Draw ¶ added in v0.4.0
func (t *TileSet) Draw(renderer DrawManager)
Draw Drawable implementation
func (*TileSet) IsDisabled ¶ added in v0.4.0
IsDisabled Drawable implementation
func (*TileSet) SetTransformMatrix ¶ added in v0.4.0
SetTransformMatrix Drawable implementation
type TiledAnimation ¶ added in v0.3.0
type TiledAnimation struct {
Clips []TiledAnimationClip
}
TiledAnimation is an animation of a single image source and many Rectangles that represent views (subimages)
func (*TiledAnimation) Count ¶ added in v0.3.0
func (a *TiledAnimation) Count() int
Count returns the total count of cnimation clips
func (*TiledAnimation) Each ¶ added in v0.3.0
func (a *TiledAnimation) Each(fn func(i int, clip AnimationClip) bool)
Each iterates through all animation clips
func (*TiledAnimation) GetClip ¶ added in v0.3.0
func (a *TiledAnimation) GetClip(index int) AnimationClip
GetClip returns an animation clip by index
func (*TiledAnimation) GetClipEvents ¶ added in v0.3.0
func (a *TiledAnimation) GetClipEvents(index int) []*AnimationEvent
GetClipEvents returns all animation clip events by the clip index
func (*TiledAnimation) GetClipImage ¶ added in v0.3.0
func (a *TiledAnimation) GetClipImage(clipi, frame int) *ebiten.Image
GetClipImage returns the clip image
func (*TiledAnimation) GetClipOffset ¶ added in v0.3.0
func (a *TiledAnimation) GetClipOffset(clipi, frame int) (x, y float64)
GetClipOffset returns the clip offset
func (*TiledAnimation) GetClipRect ¶ added in v0.3.0
func (a *TiledAnimation) GetClipRect(clipi, frame int) image.Rectangle
GetClipRect returns the clip Rectangle (bounds)
type TiledAnimationClip ¶ added in v0.3.0
type TiledAnimationClip struct {
// The name of an animation is not allowed to be changed during runtime
// but since this is part of a component (and components shouldn't have logic),
// it is a public member.
Name string
Image *ebiten.Image
Frames []image.Rectangle
Events []*AnimationEvent //TODO: link
Fps float64
ClipMode AnimClipMode
EndedEvent *AnimationEvent //TODO: link
}
TiledAnimationClip is an animation clip, like a character walk cycle.
func (TiledAnimationClip) GetEndedEvent ¶ added in v0.3.0
func (c TiledAnimationClip) GetEndedEvent() *AnimationEvent
func (TiledAnimationClip) GetEvents ¶ added in v0.3.0
func (c TiledAnimationClip) GetEvents() []*AnimationEvent
func (TiledAnimationClip) GetFPS ¶ added in v0.3.0
func (c TiledAnimationClip) GetFPS() float64
func (TiledAnimationClip) GetFrameCount ¶ added in v0.3.0
func (c TiledAnimationClip) GetFrameCount() int
func (TiledAnimationClip) GetImage ¶ added in v0.3.0
func (c TiledAnimationClip) GetImage(frame int) *ebiten.Image
func (TiledAnimationClip) GetMode ¶ added in v0.3.0
func (c TiledAnimationClip) GetMode() AnimClipMode
func (TiledAnimationClip) GetName ¶ added in v0.3.0
func (c TiledAnimationClip) GetName() string
GetName returns the animation clip name
func (TiledAnimationClip) GetOffset ¶ added in v0.3.0
func (c TiledAnimationClip) GetOffset(frame int) (x, y float64)
GetOffset is anoop for TiledAnimationClip
type Transform ¶
type Transform struct {
Parent *Transform
X float64
Y float64
Angle float64
ScaleX float64
ScaleY float64
// contains filtered or unexported fields
}
Transform is a hierarchy based matrix
func NewTransform ¶
func NewTransform() *Transform
NewTransform returns a new transform with ScaleX = 1 and ScaleY = 1
type TransformComponentSystem ¶
type TransformComponentSystem struct {
BaseComponentSystem
}
func (*TransformComponentSystem) Components ¶
func (cs *TransformComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*TransformComponentSystem) ExcludeComponents ¶
func (cs *TransformComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*TransformComponentSystem) SystemExec ¶
func (cs *TransformComponentSystem) SystemExec() SystemExecFn
func (*TransformComponentSystem) SystemInit ¶
func (cs *TransformComponentSystem) SystemInit() SystemInitFn
func (*TransformComponentSystem) SystemName ¶
func (cs *TransformComponentSystem) SystemName() string
func (*TransformComponentSystem) SystemPriority ¶
func (cs *TransformComponentSystem) SystemPriority() int
type TransformDrawableComponentSystem ¶
type TransformDrawableComponentSystem struct {
BaseComponentSystem
}
func (*TransformDrawableComponentSystem) Components ¶
func (cs *TransformDrawableComponentSystem) Components(w *ecs.World) []*ecs.Component
func (*TransformDrawableComponentSystem) ExcludeComponents ¶
func (cs *TransformDrawableComponentSystem) ExcludeComponents(w *ecs.World) []*ecs.Component
func (*TransformDrawableComponentSystem) SystemExec ¶
func (cs *TransformDrawableComponentSystem) SystemExec() SystemExecFn
func (*TransformDrawableComponentSystem) SystemInit ¶
func (cs *TransformDrawableComponentSystem) SystemInit() SystemInitFn
SystemInit returns the system init
func (*TransformDrawableComponentSystem) SystemName ¶
func (cs *TransformDrawableComponentSystem) SystemName() string
func (*TransformDrawableComponentSystem) SystemPriority ¶
func (cs *TransformDrawableComponentSystem) SystemPriority() int