API

API

World

A collection of entities and their components.

ECSComponent

A representation of an entity component system component.

EntityKey

A generational index to an entity that will fail in usage if the entity has been destroyed.

register!(world::World,::Type{C}) where C <: ECSComponent

Registers storage space for a component type.

createentity!(world::World)

Allocates an entity and returns an entity key.

getentity(world::World,key::EntityKey)

Returns entity index if entity key is still valid.

destroyentity!(world::World,entity::EntityKey)

Deallocates entity and memory if entity key is valid.

addcomponent!(world::World,entity::EntityKey,component::C) where C <: ECSComponent

Associate a component with an entity key.

removecomponent!(world::World,entity::EntityKey,::Type{C}) where C <: ECSComponent

Dissociate a component of a specific type with an entity key.

getcomponent(world::World,entity::EntityKey,::Type{C}) where C <: ECSComponent

Get a component of a specific type of an entity key.

runsystem!(f,world::World,types::Array{DataType,1})

For each entity with components of passed in types, call provided function with that entity and components.