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 EventListener ¶
type EventListener interface {
OnEvent(event Event)
}
func NewEventListener ¶
func NewEventListener(callback EventListenerFunc) EventListener
type EventListenerFunc ¶
type EventListenerFunc func(event Event)
Click to show internal directories.
Click to hide internal directories.