Manages registered components and its arrays.
More...
#include <component.hpp>
|
| template<typename T> |
| void | RegisterComponent () |
| | Registers a component type creating a ComponentArray and an ID.
|
| template<typename T> |
| ComponentID | GetComponentID () |
| | Gets the ID of a component.
|
| template<typename T> |
| void | AddComponent (Entity entity, T component) |
| | Adds a component and its data to an entity.
|
| template<typename T> |
| void | RemoveComponent (Entity entity) |
| | Removes a component and its data from an entity.
|
| template<typename T> |
| T & | GetComponent (Entity entity) |
| | Get components data associated with an entity.
|
| template<typename T> |
| bool | HasComponent (Entity entity) |
| | Checks if en entity has a component.
|
| void | EntityDespawned (Entity entity) |
| | Remove components associated with an entity.
|
Manages registered components and its arrays.
◆ AddComponent()
template<typename T>
| void acheron::ecs::ComponentManager::AddComponent |
( |
Entity | entity, |
|
|
T | component ) |
|
inline |
Adds a component and its data to an entity.
- Template Parameters
-
| T | The component type to add to the entity |
- Parameters
-
| entity | The entity to add a component and its data for |
| component | The components data |
◆ EntityDespawned()
| void ComponentManager::EntityDespawned |
( |
Entity | entity | ) |
|
Remove components associated with an entity.
- Parameters
-
| entity | Entity to remove components from |
◆ GetComponent()
template<typename T>
| T & acheron::ecs::ComponentManager::GetComponent |
( |
Entity | entity | ) |
|
|
inline |
Get components data associated with an entity.
- Template Parameters
-
| T | The component type to get the data for from an entity |
- Returns
- Component data associated with the entity
◆ GetComponentID()
template<typename T>
| ComponentID acheron::ecs::ComponentManager::GetComponentID |
( |
| ) |
|
|
inline |
Gets the ID of a component.
- Template Parameters
-
| T | The component to get the ID for |
- Returns
- The ID for the component
- Exceptions
-
| Assert | Fail if the component wasnt registered yet |
◆ HasComponent()
template<typename T>
| bool acheron::ecs::ComponentManager::HasComponent |
( |
Entity | entity | ) |
|
|
inline |
Checks if en entity has a component.
- Parameters
-
| entity | The entity to check |
- Returns
- If component has entity
◆ RegisterComponent()
template<typename T>
| void acheron::ecs::ComponentManager::RegisterComponent |
( |
| ) |
|
|
inline |
Registers a component type creating a ComponentArray and an ID.
- Template Parameters
-
| T | The component type to be registered |
- Exceptions
-
| Assert | Fail if the component was already registered |
◆ RemoveComponent()
template<typename T>
| void acheron::ecs::ComponentManager::RemoveComponent |
( |
Entity | entity | ) |
|
|
inline |
Removes a component and its data from an entity.
- Template Parameters
-
| T | The component type to remove from the entity |
- Parameters
-
| entity | The entity to remove a component and its data for |
The documentation for this class was generated from the following files: