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
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

get_from_id
Component get_from_id(ComponentId id)

get a component from its id reference

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
Component[] components;

basic component storage

manager
EntityManager manager;

the entity manager

renderable_components
Component[] renderable_components;

components that implement Renderable

updatable_components
Component[] updatable_components;

components that implement Updatable

updatable_renderable_components
Component[] updatable_renderable_components;

components that implement Updatable and Renderable

Meta