Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity interface { ID() uint64 // Destroy removes all components and removes the entity from the world. // In case someone holds a reference to the entity and adds a new component, the entity will be restored. Destroy() // Get gets an existing component with the type of the passed component. // If the component doesn't exist and is not nil passed, the component will be added to entity. Get(c Component) Component // Has returns true if there is a component with the passed type on entity. Has(c Component) bool // Replace adds a component to the entity if it doesn't exist, or replaces it if it exists. // If the type is nil, it does nothing. Replace(c Component) // Delete removes the component with the passed type. Delete(c Component) // Components returns all entity component. Components() []Component }
Entity ecs interface.
type System ¶
type System interface { // GetFilters returns filters with a list of components. GetFilters() []SystemFilter // Update is called on every tick. // delta - time elapsed from the previous tick. // filtered - filtered entity list by filters from the GetFilters method. // Always contains the same number of elements as the GetFilters method returns, in the same filter order. // filtered - [FilterIndex][EntityIndex]Entity Update(delta time.Duration, filtered [][]Entity) }
System ecs interface.
func NewOneFrame ¶
NewOneFrame returns a system that, when called, removes the component from all entities. Takes in a component whose type is to be removed.
The use of this system involves adding it at the very end of the list of systems, so that the deletion occurs at the end of the cycle.
type SystemDestroyer ¶
type SystemDestroyer interface { System Destroy() }
SystemDestroyer ecs interface.
type SystemFilter ¶
SystemFilter contains components for filtering entity when calling System.Update method on the system.
Include - the components that should be on the entity. Exclude - the components of which should not be on the entity.
type SystemFull ¶
type SystemFull interface { SystemIniter SystemDestroyer }
SystemFull ecs interface.
type World ¶
type World interface { NewEntity() Entity AddSystem(s System) RemoveSystem(s System) SystemsInit() error // SystemsUpdate calls an update on all systems. Takes in the time elapsed from the previous call. SystemsUpdate(delta time.Duration) SystemsDestroy() // Run calls the Update method with a TPS (Tick per second) rate. Blocking method! Run(tps uint) error Stop() }
World ecs interface.
Click to show internal directories.
Click to hide internal directories.