ComponentStorage

helper class for storing components in an optimized way

Constructors

this
this(EntityManager manager)

sets up a component storage helper

Members

Functions

destroy_all
void destroy_all(Entity entity)

destroy all components attached to an entity

get
Component get(ComponentId id)

get a component from its id reference

get
T get(Entity entity)

get the first component in an entity matching a type

get_all
Component[] get_all(Entity entity)

get all components in an entity

get_all
T[] get_all(Entity entity)

get all components in an entity matching a type

has_component
bool has_component(Entity entity)

checks if an entity has a component with a matching type

insert
ComponentId insert(Entity entity, Component component)

attaches a component to an entity

remove
void remove(Entity entity, Component to_remove)

removes a component from its owner entity

Variables

components
Array!Component components;

basic component storage

manager
EntityManager manager;

the entity manager

renderable_components
Array!Component renderable_components;

components that implement Renderable

updatable_components
Array!Component updatable_components;

components that implement Updatable

Meta