![]() |
xyginext
0.2.0
Second generation of xygine game creation framework
|
Manages the relationship between an Entity and its components. More...
#include <Entity.hpp>
Public Member Functions | |
EntityManager (MessageBus &, ComponentManager &, std::size_t=256) | |
EntityManager (const EntityManager &)=delete | |
EntityManager (EntityManager &&)=delete | |
EntityManager & | operator= (const EntityManager &)=delete |
EntityManager & | operator= (EntityManager &&)=delete |
Entity | createEntity () |
Creates a new Entity. | |
void | destroyEntity (Entity) |
Destroys the given Entity. | |
bool | entityDestroyed (Entity) const |
Returns true if the entity is destroyed or marked for destruction. | |
Entity | getEntity (Entity::ID) const |
Returns the entity at the given index if it exists TODO what if it doesn't? | |
template<typename T > | |
void | addComponent (Entity, T) |
Adds a copy of the given component to the given Entity. | |
template<typename T , typename... Args> | |
T & | addComponent (Entity, Args &&... args) |
Constructs a component on the given entity using the given params. | |
template<typename T > | |
bool | hasComponent (Entity) const |
Returns true if the given Entity has a component of this type. | |
template<typename T > | |
T & | getComponent (Entity) |
Returns a pointer to the component of this type if it exists on the given Entity else returns nullptr. | |
const ComponentMask & | getComponentMask (Entity) const |
Returns a reference to the component mask of the given Entity. Component masks are used to identify whether an Entity has a particular component. | |
bool | owns (Entity) const |
Returns true if this manager owns the given entity. | |
void | setLabel (Entity, const std::string &) |
const std::string & | getLabel (Entity) const |
Returns the label assigned to the given entity. May be empty. | |
std::size_t | getEntityCount () const |
Returns the number of active entities in the manager. | |
template<typename T > | |
void | addComponent (Entity entity, T component) |
template<typename T , typename... Args> | |
T & | addComponent (Entity entity, Args &&... args) |
template<typename T > | |
bool | hasComponent (Entity entity) const |
template<typename T > | |
T & | getComponent (Entity entity) |
template<typename T > | |
Detail::ComponentPool< T > & | getPool () |
Manages the relationship between an Entity and its components.
void xy::EntityManager::setLabel | ( | Entity | , |
const std::string & | |||
) |
\breif Sets the label on the given entity