Atlas
A Convenient Entity Component System
|
Manages all Entities and Components within the a World. More...
#include <EntityManager.h>
Public Member Functions | |
EntityManager (World &world) | |
Creates a new EntityManager. More... | |
void | update () |
Removes all entities that have been set to inactive. More... | |
Entity & | createEntity () |
Creates an empty Entity. More... | |
Entity & | getEntity (const Entity::ID &ID) const |
Retreives an active Entity. More... | |
void | addComponent (Entity &entity, Component::Ptr component) |
Attaches a Component to an Entity. More... | |
void | removeComponent (Entity &entity, const ComponentIdentifier &componentIdentifier) |
Removes a Component from an Entity. More... | |
template<typename T > | |
T * | getComponentFor (const Entity &entity) const |
Retrieve a specific Component from an Entity. More... | |
template<typename T > | |
T * | getComponentFor (const Entity::ID &ID) const |
Retrieve a specific Component from an Entity. More... | |
std::vector< Component * > | getAllComponentsFor (const Entity &entity) |
Retrieves all the Components attached to an Entity. More... | |
void | removeAllComponentsFor (Entity &entity) |
Removes and destroys all the Components attached to a Entity. More... | |
void | toString () |
Prints the contents of all active Entities and displays the number of inactive Entities. More... | |
![]() | |
NonCopyable ()=default | |
Default Constructor. More... | |
virtual | ~NonCopyable () |
Manages all Entities and Components within the a World.
Entities and Components will be directly or indirectly retrieved and added through the EntityManager.
Atlas::EntityManager::EntityManager | ( | World & | world | ) |
Creates a new EntityManager.
world | - the World object that owns this EntityManager |
void Atlas::EntityManager::addComponent | ( | Entity & | entity, |
Component::Ptr | component | ||
) |
Entity& Atlas::EntityManager::createEntity | ( | ) |
|
inline |
|
inline |
Entity& Atlas::EntityManager::getEntity | ( | const Entity::ID & | ID | ) | const |
void Atlas::EntityManager::removeAllComponentsFor | ( | Entity & | entity | ) |
void Atlas::EntityManager::removeComponent | ( | Entity & | entity, |
const ComponentIdentifier & | componentIdentifier | ||
) |
Removes a Component from an Entity.
Usage Example:
entity | - The Entity to remove a Component from |
componentIdentifier | - Identifier for the Component |
void Atlas::EntityManager::toString | ( | ) |
Prints the contents of all active Entities and displays the number of inactive Entities.
void Atlas::EntityManager::update | ( | ) |
Removes all entities that have been set to inactive.