Acheron
Loading...
Searching...
No Matches
acheron::ecs::ComponentManager Class Reference

Manages registered components and its arrays. More...

#include <component.hpp>

Public Member Functions

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.

Detailed Description

Manages registered components and its arrays.

Member Function Documentation

◆ 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
TThe component type to add to the entity
Parameters
entityThe entity to add a component and its data for
componentThe components data

◆ EntityDespawned()

void ComponentManager::EntityDespawned ( Entity entity)

Remove components associated with an entity.

Parameters
entityEntity 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
TThe 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
TThe component to get the ID for
Returns
The ID for the component
Exceptions
AssertFail 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
entityThe 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
TThe component type to be registered
Exceptions
AssertFail 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
TThe component type to remove from the entity
Parameters
entityThe entity to remove a component and its data for

The documentation for this class was generated from the following files: