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 AfterFuncComponentSystem
- type AnimClipMode
- 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 BeforeFuncComponentSystem
- type ComponentSystem
- type Context
- 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 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 LayerIndex
- type LayerTuple
- type Middleware
- type Observer
- 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) ClearTransformMatrix()
- func (s *Sprite) Destroy()
- func (s *Sprite) Draw(screen *ebiten.Image, opt *ebiten.DrawImageOptions)
- func (s *Sprite) DrawImageOptions() *ebiten.DrawImageOptions
- 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) SetBounds(b image.Rectangle)
- func (s *Sprite) SetImage(img *ebiten.Image)
- func (s *Sprite) SetTransformMatrix(m ebiten.GeoM)
- func (s *Sprite) Size() (w, h float64)
- func (s *Sprite) Update(ctx Context)
- type SpriteAnimation
- type SpriteAnimationClip
- 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 SpriteAnimationEvent
- 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 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 ( // 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 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 AnimationEventFn ¶
type AnimationEventFn func(name, value string)
type AnimationEventID ¶
type AnimationEventID int64
type AnimationEventListeners ¶
type AnimationEventListeners struct {
// contains filtered or unexported fields
}
func (*AnimationEventListeners) Add ¶
func (ae *AnimationEventListeners) Add(name string, fn AnimationEventFn) AnimationEventID
func (*AnimationEventListeners) AddCatchAll ¶
func (ae *AnimationEventListeners) AddCatchAll(fn AnimationEventFn) AnimationEventID
func (*AnimationEventListeners) Clear ¶
func (ae *AnimationEventListeners) Clear()
func (*AnimationEventListeners) Dispatch ¶
func (ae *AnimationEventListeners) Dispatch(name, value string)
func (*AnimationEventListeners) Remove ¶
func (ae *AnimationEventListeners) Remove(id AnimationEventID) bool
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 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 ComponentSystem ¶
type Context ¶
type Context interface {
ecs.Context
Engine() Engine
FPS() float64
Frame() int64
IsDrawingSkipped() bool
DefaultDrawImageOptions() *ebiten.DrawImageOptions
Screen() *ebiten.Image
}
Context is the context passed to every system update function.
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 Drawable ¶
type Drawable interface {
Update(ctx Context)
Draw(screen *ebiten.Image, opt *ebiten.DrawImageOptions)
Destroy()
DrawImageOptions() *ebiten.DrawImageOptions
IsDisabled() bool
Size() (w, h float64)
SetTransformMatrix(m ebiten.GeoM)
ClearTransformMatrix()
SetBounds(b image.Rectangle)
}
Drawable is the basis of all ebiten drawable items (sprites, texts, shapes)
type DrawableImager ¶
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 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 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
Y float64
Angle float64
ScaleX float64
ScaleY float64
OriginX float64
OriginY float64
Bounds image.Rectangle // Bounds for drawing subimage
Options *ebiten.DrawImageOptions
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) ClearTransformMatrix ¶
func (s *Sprite) ClearTransformMatrix()
func (*Sprite) DrawImageOptions ¶
func (s *Sprite) DrawImageOptions() *ebiten.DrawImageOptions
func (*Sprite) GetPrecomputedImage ¶
GetPrecomputedImage returns the last precomputed image
func (*Sprite) GetPrecomputedImageDim ¶
GetPrecomputedImageDim returns the last precomputed image dimmensions
func (*Sprite) IsDisabled ¶
func (*Sprite) SetTransformMatrix ¶
type SpriteAnimation ¶
type SpriteAnimation struct {
Enabled bool
Playing bool
ActiveClip int
ActiveFrame int
Clips []SpriteAnimationClip
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
type SpriteAnimationClip ¶
type SpriteAnimationClip 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 []*SpriteAnimationEvent //TODO: link
Fps float64
ClipMode AnimClipMode
EndedEvent *SpriteAnimationEvent //TODO: link
}
SpriteAnimationClip is an animation clip, like a character walk cycle.
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 SpriteAnimationEvent ¶
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 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