Documentation ¶
Index ¶
- type BaseComponent
- type BaseSystem
- type Entity
- type EntityID
- type SimpleSystem
- type System
- type World
- func (w *World) AddEntity(es ...Entity)
- func (w *World) AddSystem(ss ...System)
- func (w *World) GetEntityByID(id EntityID) (Entity, bool)
- func (w *World) GetEntityCount() int
- func (w *World) GetSystemCount() int
- func (w *World) QueryEntity(i reflect.Type) []Entity
- func (w *World) RemoveEntity(es ...Entity)
- func (w *World) RemoveSystem(ss ...System)
- func (w *World) Update()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseComponent ¶
type BaseComponent struct {
// contains filtered or unexported fields
}
func (BaseComponent) GetID ¶
func (b BaseComponent) GetID() EntityID
type BaseSystem ¶
func (*BaseSystem) GetPriority ¶
func (bs *BaseSystem) GetPriority() int
func (*BaseSystem) Init ¶
func (bs *BaseSystem) Init(world *World)
type SimpleSystem ¶
type SimpleSystem[T Entity] struct { BaseSystem }
If a system will only act on one kind of entity, the simple system simplify querying the world for this kind of entities
func (*SimpleSystem[T]) Query ¶
func (ss *SimpleSystem[T]) Query() []Entity
type System ¶
type System interface { // Called once on initialisation. // Systems will be called by decreasing number of priority. If multiple system // have the same priority, the calling order is undefined and shouldn't be // relied on. // Priority changes after initialisation will not be considered. GetPriority() int // Called on each world update, arg is milisec since last world update Update(dt int64) // Called when the system is added to a world Init(world *World) }
type World ¶
type World struct {
// contains filtered or unexported fields
}
func (*World) GetEntityCount ¶
func (*World) GetSystemCount ¶
func (*World) QueryEntity ¶
Return every entity in the world that implements the interface 'i'
func (*World) RemoveEntity ¶
func (*World) RemoveSystem ¶
Click to show internal directories.
Click to hide internal directories.