Documentation
¶
Index ¶
- Variables
- func GetComponent[C any](e *Entity) (C, bool)
- func HasComponent[C any](e *Entity) bool
- func HasHandler[C any](e *Entity) bool
- func RemoveComponent[C any](e *Entity)
- func RemoveHandler[C any](e *Entity)
- func SetComponent[C any](e *Entity, component C)
- func SetHandler[C any](e *Entity, handler Handler[C])
- func WithComponents(components []any) func(*Entity)
- func WithHandlers(handlers typemap.TypeMap[Handler[any]]) func(*Entity)
- func WithID(id ID) func(*Entity)
- func WithName(name string) func(*Entity)
- type CommandType
- type ComponentRemovedEvent
- type ComponentType
- type ComponentUpdatedEvent
- type Context
- func (c *Context) Add(ent *Entity) error
- func (c *Context) All() iter.Seq[*Entity]
- func (c *Context) Close() error
- func (c *Context) EventBus() *event.Bus
- func (c *Context) Get(id ID) (*Entity, bool)
- func (c *Context) GetNamed(name string) (*Entity, bool)
- func (c *Context) Has(ent *Entity) bool
- func (c *Context) HasId(id ID) bool
- func (c *Context) HasNamed(name string) bool
- func (c *Context) IsActive() bool
- func (c *Context) Owns(ent *Entity) bool
- func (c *Context) OwnsDeep(ent *Entity) bool
- func (c *Context) Remove(ent *Entity) error
- func (c *Context) RemoveId(id ID) error
- func (c *Context) SubContext() *Context
- type Entity
- func (e *Entity) Components() []any
- func (e *Entity) GetComponent(component any) (any, bool)
- func (e *Entity) GetComponentType(component ComponentType) (any, bool)
- func (e *Entity) GetHandler(command any) (Handler[any], bool)
- func (e *Entity) GetHandlerType(command CommandType) (Handler[any], bool)
- func (e *Entity) Handlers() []Handler[any]
- func (e *Entity) HasComponent(component any) bool
- func (e *Entity) HasComponentType(typ ComponentType) bool
- func (e *Entity) HasHandler(command any) bool
- func (e *Entity) HasHandlerType(command CommandType) bool
- func (e *Entity) HasName() bool
- func (e *Entity) ID() ID
- func (e *Entity) IsBound() bool
- func (e *Entity) Name() string
- func (e *Entity) RemoveComponent(component any)
- func (e *Entity) RemoveComponentType(component ComponentType)
- func (e *Entity) RemoveComponentTypes(components ...ComponentType)
- func (e *Entity) RemoveComponents(components ...any)
- func (e *Entity) RemoveHandler(command any)
- func (e *Entity) RemoveHandlerType(command CommandType)
- func (e *Entity) RemoveHandlerTypes(commands ...CommandType)
- func (e *Entity) RemoveHandlers(commands ...any)
- func (e *Entity) SetComponent(component any)
- func (e *Entity) SetComponents(components ...any)
- func (e *Entity) SetHandler(command any, handler Handler[any])
- func (e *Entity) SetHandlerType(command CommandType, handler Handler[any])
- func (e *Entity) String() string
- type EntityAddedEvent
- type EntityRemovedEvent
- type Handler
- type HandlersUpdatedEvent
- type ID
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrContextClosed = errors.New("registry context is closed")
View Source
var ErrEntityDuplicateID = errors.New("duplicate entity id")
View Source
var ErrEntityDuplicateName = errors.New("duplicate entity name in context")
View Source
var ErrInvalidCommandType = errors.New("invalid command type")
Functions ¶
func GetComponent ¶
func HasComponent ¶
func HasHandler ¶
func RemoveComponent ¶
func RemoveHandler ¶
func SetComponent ¶
func SetHandler ¶
func WithComponents ¶
Types ¶
type CommandType ¶
type ComponentRemovedEvent ¶
type ComponentType ¶
type ComponentUpdatedEvent ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) SubContext ¶
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func (*Entity) Components ¶
func (*Entity) GetComponentType ¶
func (e *Entity) GetComponentType(component ComponentType) (any, bool)
func (*Entity) GetHandlerType ¶
func (e *Entity) GetHandlerType(command CommandType) (Handler[any], bool)
func (*Entity) HasComponent ¶
func (*Entity) HasComponentType ¶
func (e *Entity) HasComponentType(typ ComponentType) bool
func (*Entity) HasHandler ¶
func (*Entity) HasHandlerType ¶
func (e *Entity) HasHandlerType(command CommandType) bool
func (*Entity) RemoveComponent ¶
func (*Entity) RemoveComponentType ¶
func (e *Entity) RemoveComponentType(component ComponentType)
func (*Entity) RemoveComponentTypes ¶
func (e *Entity) RemoveComponentTypes(components ...ComponentType)
func (*Entity) RemoveComponents ¶
func (*Entity) RemoveHandler ¶
func (*Entity) RemoveHandlerType ¶
func (e *Entity) RemoveHandlerType(command CommandType)
func (*Entity) RemoveHandlerTypes ¶
func (e *Entity) RemoveHandlerTypes(commands ...CommandType)
func (*Entity) RemoveHandlers ¶
func (*Entity) SetComponent ¶
func (*Entity) SetComponents ¶
func (*Entity) SetHandlerType ¶
func (e *Entity) SetHandlerType(command CommandType, handler Handler[any])
type EntityAddedEvent ¶
type EntityAddedEvent struct {
Entity *Entity
}
type EntityRemovedEvent ¶
type EntityRemovedEvent struct {
Entity *Entity
}
type HandlersUpdatedEvent ¶
type HandlersUpdatedEvent struct {
Entity *Entity
}
Click to show internal directories.
Click to hide internal directories.