ecs

package
v0.0.0-...-1c1542d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface{}

type ComponentManager

type ComponentManager struct {
	// contains filtered or unexported fields
}

func NewComponentManager

func NewComponentManager() *ComponentManager

NewComponentManager creates a new instance of ComponentManager.

func (*ComponentManager) AddComponent

func (manager *ComponentManager) AddComponent(entity Entity, component Component)

AddComponent adds a component a entity

func (*ComponentManager) GetComponent

func (manager *ComponentManager) GetComponent(entity Entity, componentName string) (Component, bool)

GetComponent returns the component if it exists.

func (*ComponentManager) HasComponent

func (manager *ComponentManager) HasComponent(entity Entity, componentName string) bool

HasComponent returns true if the entity has the component.

func (*ComponentManager) HasComponents

func (manager *ComponentManager) HasComponents(entity Entity, componentNames ...string) bool

HasComponents returns true if the entity has all the components in the list.

type Entity

type Entity uint32

type EntityManager

type EntityManager struct {
	// contains filtered or unexported fields
}

func NewEntityManager

func NewEntityManager() *EntityManager

NewEntityManager instantiates a new EntityManager.

func (*EntityManager) DestroyEntity

func (manager *EntityManager) DestroyEntity(entity Entity)

DestroyEntity destroys an entity.

func (*EntityManager) GetAllEntities

func (manager *EntityManager) GetAllEntities() []Entity

GetAllEntities returns all entities.

func (*EntityManager) HasEntity

func (manager *EntityManager) HasEntity(entity Entity) bool

HasEntity returns true if the entity exists.

func (*EntityManager) NewEntity

func (manager *EntityManager) NewEntity() Entity

NewEntity creates a new entity.

type System

type System interface {
	Update(dt float32)
	Draw() // for renderer systems
}

type SystemManager

type SystemManager struct {
	// contains filtered or unexported fields
}

func NewSystemManager

func NewSystemManager() *SystemManager

NewSystemManager instantiates a new SystemManager.

func (*SystemManager) AddSystem

func (manager *SystemManager) AddSystem(system System)

AddSystem adds a system to the SystemManager.

func (*SystemManager) DrawSystems

func (manager *SystemManager) DrawSystems()

DrawSystems iterates through the systems in the SystemManager and calls the Draw method on each system.

func (*SystemManager) GetAllSystems

func (manager *SystemManager) GetAllSystems() []System

GetAllSystems returns all systems in the SystemManager.

func (*SystemManager) UpdateSystems

func (manager *SystemManager) UpdateSystems(dt float32)

UpdateSystems updates all systems in the SystemManager with the given delta time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL