ecs

package
v0.0.0-...-4db4b9c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentType

type ComponentType string

ComponentType is used to describe a specific type of component that can be added to an Entity

type Entity

type Entity int

Entity represents an object in the Game scene. It can be anything from the main hero to a building or a tree.

type EntityManager

type EntityManager interface {

	// CreateEntity creates a brand new Entity object.
	CreateEntity() Entity

	// HasEntity can be used to check if a given entity is part of this
	// EntityManager or has been deleted.
	HasEntity(Entity) bool

	// DeleteEntity deletes an existing Entity object.
	DeleteEntity(Entity)

	// DeleteAllEntities deletes all existing Entity objects managed by this
	// EntityManager.
	DeleteAllEntities()

	// AddEntityComponent adds a component of the specified type
	// to the specified entity
	AddEntityComponent(Entity, ComponentType, interface{})

	// EntityHasComponent checks whether the specified entity has a
	// component of the specified type
	EntityHasComponent(Entity, ComponentType) bool

	// EntityComponent returns the component of the specified type contained
	// by the specified entity
	EntityComponent(Entity, ComponentType) interface{}

	// RemoveEntityComponent removes the component of the specified type from
	// the specified entity
	RemoveEntityComponent(Entity, ComponentType)
}

EntityManager manages the lifecycle of all Entity object in the game.

func NewEntityManager

func NewEntityManager() EntityManager

NewEntityManager creates a new EntityManager instance.

type Event

type Event interface {
	Source() Entity
}

type EventListener

type EventListener interface {
	OnEvent(event Event)
}

func NewEventListener

func NewEventListener(callback EventListenerFunc) EventListener

type EventListenerFunc

type EventListenerFunc func(event Event)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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