Documentation ¶
Index ¶
- type Buffer
- type ComToBool
- type Component
- type Entity
- func (e *Entity) AddComponent(c IComponent) *util.Err
- func (e *Entity) AddComponents(components ...IComponent)
- func (e *Entity) Components() []IComponent
- func (e *Entity) DelComponent(t TComponent) bool
- func (e *Entity) Dispose()
- func (e *Entity) GetComponent(t TComponent) (IComponent, bool)
- func (e *Entity) Id() string
- func (e *Entity) IterComponent(fn func(IComponent))
- func (e *Entity) Scene() *Scene
- type EntityToBool
- type EntityToErr
- type EntityToEvent
- type FnBufferJob
- type FnCom
- type FnComponentBuffer
- type FnEntity
- type FnEntityBuffer
- type FnEntityCom
- type FnEntityEvent
- type FnEntityFrame
- type FnEntityStr
- type FnEntityTCom
- type FnEvent
- type FnEvents
- type FnFrame
- type FnJob
- type FnLinkAnySlc
- type FnScene
- type FnSceneM
- type FnSceneStr
- type Frame
- func (f *Frame) AddSystem(system ISystem, before TSystem)
- func (f *Frame) After() *ds.FnLink
- func (f *Frame) AfterClearTags(tags ...string)
- func (f *Frame) Before() *ds.FnLink
- func (f *Frame) DelSystem(t TSystem)
- func (f *Frame) DeltaMillSec() int64
- func (f *Frame) GetSystem(typ TSystem) (ISystem, bool)
- func (f *Frame) NowMillSecs() int64
- func (f *Frame) Num() int64
- func (f *Frame) PushJob(name JobName, data ...any)
- func (f *Frame) PutJob(name JobName, data ...any)
- func (f *Frame) Scene() *Scene
- func (f *Frame) Start()
- func (f *Frame) StartTime() int64
- func (f *Frame) Stop()
- type FrameOption
- type IComponent
- type IEvent
- type ISystem
- type JobName
- type Scene
- func (s *Scene) AddEntity(e *Entity) *util.Err
- func (s *Scene) BindAddComponent(fn FnEntityCom)
- func (s *Scene) BindAfterAddEntity(fn FnEntity)
- func (s *Scene) BindAfterDisposeEntity(fn FnEntity)
- func (s *Scene) BindBeforeAddEntity(fn EntityToErr)
- func (s *Scene) BindBeforeDisposeEntity(fn EntityToErr)
- func (s *Scene) BindDelComponent(fn FnEntityTCom)
- func (s *Scene) ClearComponentTags(component IComponent)
- func (s *Scene) ClearTag(tag string) bool
- func (s *Scene) ClearTags(tags ...string)
- func (s *Scene) Data() util.M
- func (s *Scene) DelEntity(id string) *util.Err
- func (s *Scene) Dispose()
- func (s *Scene) Entities() []*Entity
- func (s *Scene) EntityCount() int
- func (s *Scene) EntityIds(ids *[]string)
- func (s *Scene) GetEntity(id string) (*Entity, bool)
- func (s *Scene) GetTagComponents(tag string) ([]IComponent, bool)
- func (s *Scene) HasTagComponent(component IComponent, tag string) bool
- func (s *Scene) Id() string
- func (s *Scene) IsEmpty() bool
- func (s *Scene) IterEntities(fn FnEntity)
- func (s *Scene) TagComponent(component IComponent, tags ...string)
- func (s *Scene) TagEntityComponent(entityId string, t TComponent, tags ...string)
- func (s *Scene) TestGetTagComponents(tag string) (*ds.SetItem[string, IComponent], bool)
- func (s *Scene) TransferComponentTag(target string, origin string)
- func (s *Scene) Type() TScene
- func (s *Scene) UntagComponent(component IComponent, tags ...string)
- type SceneToErr
- type System
- func (s *System) BindJob(name JobName, fn util.FnAnySlc)
- func (s *System) BindPFnJob(name JobName, fn FnLinkAnySlc)
- func (s *System) BindPJob(name JobName, fn util.FnAnySlc)
- func (s *System) DoJob(name JobName)
- func (s *System) Frame() *Frame
- func (s *System) FrameAfter() *ds.FnLink
- func (s *System) FrameBefore() *ds.FnLink
- func (s *System) Jobs() []worker.JobName
- func (s *System) OnAfterStart()
- func (s *System) OnBeforeStart()
- func (s *System) OnStart(frame *Frame)
- func (s *System) OnStop()
- func (s *System) OnUpdate()
- func (s *System) PEntities(fn func(*Entity)) []*Entity
- func (s *System) PEntitiesWithParams(fn func(*Entity, []any), params ...any) []*Entity
- func (s *System) PTagComponents(tag string, fn func(IComponent)) ([]IComponent, bool)
- func (s *System) PTagComponentsToFnLink(tag string, fn func(IComponent, *ds.FnLink)) ([]IComponent, bool)
- func (s *System) PTagComponentsToFnLinkWithParams(tag string, fn func(IComponent, []any, *ds.FnLink), params ...any) ([]IComponent, bool)
- func (s *System) PTagComponentsWithParams(tag string, fn func(IComponent, []any), params ...any) ([]IComponent, bool)
- func (s *System) PutJob(name worker.JobName, data ...any)
- func (s *System) Scene() *Scene
- func (s *System) Type() TSystem
- type TComponent
- type TEvent
- type TJob
- type TScene
- type TSystem
- type ToEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComToBool ¶
type ComToBool func(IComponent) bool
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
func NewComponent ¶
func NewComponent(t TComponent) Component
func (*Component) Type ¶
func (c *Component) Type() TComponent
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func (*Entity) AddComponent ¶
func (e *Entity) AddComponent(c IComponent) *util.Err
func (*Entity) AddComponents ¶
func (e *Entity) AddComponents(components ...IComponent)
func (*Entity) Components ¶
func (e *Entity) Components() []IComponent
func (*Entity) DelComponent ¶
func (e *Entity) DelComponent(t TComponent) bool
func (*Entity) GetComponent ¶
func (e *Entity) GetComponent(t TComponent) (IComponent, bool)
func (*Entity) IterComponent ¶
func (e *Entity) IterComponent(fn func(IComponent))
type EntityToBool ¶
type EntityToErr ¶
type EntityToEvent ¶
type FnBufferJob ¶
type FnCom ¶
type FnCom func(IComponent)
type FnComponentBuffer ¶
type FnComponentBuffer func(IComponent, *Buffer)
type FnEntityBuffer ¶
type FnEntityCom ¶
type FnEntityCom func(*Entity, IComponent)
type FnEntityEvent ¶
type FnEntityFrame ¶
type FnEntityStr ¶
type FnEntityTCom ¶
type FnEntityTCom func(*Entity, TComponent)
type FnLinkAnySlc ¶
type FnSceneStr ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
func NewFrame ¶
func NewFrame(scene *Scene, opts ...FrameOption) *Frame
func (*Frame) AfterClearTags ¶
func (*Frame) DeltaMillSec ¶
func (*Frame) NowMillSecs ¶
type FrameOption ¶
type FrameOption func(o *frameOption)
func FrameBeforeDispose ¶
func FrameBeforeDispose(fn FnFrame) FrameOption
func FrameMax ¶
func FrameMax(frames int64) FrameOption
func FrameSystems ¶
func FrameSystems(systems ...ISystem) FrameOption
func FrameTickDur ¶
func FrameTickDur(dur time.Duration) FrameOption
type IComponent ¶
type IComponent interface { Entity() *Entity Type() TComponent // Init 添加到Entity时调用 Init() // Start Entity添加到Scene时调用 Start() Dispose() // contains filtered or unexported methods }
func PTagComponentsTo ¶
func PTagComponentsTo[T any](s *System, tag string, fn func(IComponent) T, complete func([]T)) ([]IComponent, bool)
func PTagComponentsToLink ¶
func PTagComponentsToLink[T any](s *Scene, tag string, fn func(IComponent, *ds.Link[T]), pcr func(*ds.Link[T])) ([]IComponent, bool)
type ISystem ¶
type ISystem interface { Type() TSystem Frame() *Frame Scene() *Scene FrameBefore() *ds.FnLink FrameAfter() *ds.FnLink OnBeforeStart() OnStart(frame *Frame) OnAfterStart() OnStop() OnUpdate() PutJob(name JobName, data ...any) DoJob(name JobName) BindJob(name JobName, handler util.FnAnySlc) BindPJob(name JobName, fn util.FnAnySlc) BindPFnJob(name JobName, fn FnLinkAnySlc) PTagComponents(tag string, fn func(IComponent)) ([]IComponent, bool) PTagComponentsWithParams(tag string, fn func(IComponent, []any), params ...any) ([]IComponent, bool) PTagComponentsToFnLink(tag string, fn func(IComponent, *ds.FnLink)) ([]IComponent, bool) PTagComponentsToFnLinkWithParams(tag string, fn func(IComponent, []any, *ds.FnLink), params ...any) ([]IComponent, bool) }
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
func (*Scene) BindAddComponent ¶
func (s *Scene) BindAddComponent(fn FnEntityCom)
func (*Scene) BindAfterAddEntity ¶
func (*Scene) BindAfterDisposeEntity ¶
func (*Scene) BindBeforeAddEntity ¶
func (s *Scene) BindBeforeAddEntity(fn EntityToErr)
func (*Scene) BindBeforeDisposeEntity ¶
func (s *Scene) BindBeforeDisposeEntity(fn EntityToErr)
func (*Scene) BindDelComponent ¶
func (s *Scene) BindDelComponent(fn FnEntityTCom)
func (*Scene) ClearComponentTags ¶
func (s *Scene) ClearComponentTags(component IComponent)
func (*Scene) EntityCount ¶
func (*Scene) GetTagComponents ¶
func (s *Scene) GetTagComponents(tag string) ([]IComponent, bool)
func (*Scene) HasTagComponent ¶
func (s *Scene) HasTagComponent(component IComponent, tag string) bool
func (*Scene) IterEntities ¶
func (*Scene) TagComponent ¶
func (s *Scene) TagComponent(component IComponent, tags ...string)
func (*Scene) TagEntityComponent ¶
func (s *Scene) TagEntityComponent(entityId string, t TComponent, tags ...string)
func (*Scene) TestGetTagComponents ¶
func (*Scene) TransferComponentTag ¶
func (*Scene) UntagComponent ¶
func (s *Scene) UntagComponent(component IComponent, tags ...string)
type SceneToErr ¶
type System ¶
type System struct {
// contains filtered or unexported fields
}
func (*System) BindPFnJob ¶
func (s *System) BindPFnJob(name JobName, fn FnLinkAnySlc)
func (*System) FrameAfter ¶
func (*System) FrameBefore ¶
func (*System) OnAfterStart ¶
func (s *System) OnAfterStart()
func (*System) OnBeforeStart ¶
func (s *System) OnBeforeStart()
func (*System) PEntitiesWithParams ¶
func (*System) PTagComponents ¶
func (s *System) PTagComponents(tag string, fn func(IComponent)) ([]IComponent, bool)
func (*System) PTagComponentsToFnLink ¶
func (s *System) PTagComponentsToFnLink(tag string, fn func(IComponent, *ds.FnLink)) ([]IComponent, bool)
func (*System) PTagComponentsToFnLinkWithParams ¶
func (s *System) PTagComponentsToFnLinkWithParams(tag string, fn func(IComponent, []any, *ds.FnLink), params ...any) ([]IComponent, bool)
func (*System) PTagComponentsWithParams ¶
func (s *System) PTagComponentsWithParams(tag string, fn func(IComponent, []any), params ...any) ([]IComponent, bool)
type TComponent ¶
type TComponent string
Click to show internal directories.
Click to hide internal directories.