EntityManager

Manages entities creation and component memory management.

Constructors

this
this(EventManager eventManager, size_t maxComponent, size_t poolSize)

Constructor of the entity-manager. eventManager may be used to notify about entity creation and component registration. maxComponent sets the maximum number of components supported by the whole manager. poolSize is the chunk size in bytes for each components.

Members

Functions

capacity
size_t capacity()

Current capacity entity.

components
auto components()

Return a range of all the valid instances of a component.

create
Entity create()

Create an entity.

entitiesWith
auto entitiesWith()

Allows to browse through the entities that have a required set of components.

getEntity
Entity getEntity(Entity.Id id)

Returns an entity from an an entity-id

opApply
int opApply(int delegate(Entity entity) dg)

Allows to browse through all the valid entities of the manager with a foreach loop.

size
size_t size()

Current number of managed entities.

valid
bool valid(Entity.Id id)

Return true if the given entity ID is still valid.

Meta