Represents an entity in the ECS (Entity Component System). More...
#include <ecs.hpp>
Public Member Functions | |
void | addTransformComp (TransformComponent &&trans) |
Adds a TransformComponent to the entity. | |
std::optional< TransformComponent > & | getTransformComp () |
Retrieves the TransformComponent of the entity. | |
const std::optional< TransformComponent > & | getTransformComp () const |
Retrieves the TransformComponent of the entity (const version). | |
void | addScriptComp (ScriptComponent &&script) |
Adds a ScriptComponent to the entity. | |
std::optional< ScriptComponent > & | getScriptComp () |
Retrieves the ScriptComponent of the entity. | |
void | addRenderComp (RenderComponent &&rend) |
Adds a RenderComponent to the entity. | |
void | addMeshComp (const std::shared_ptr< Mesh > &mesh) |
Adds a MeshComponent to the entity. | |
bool | hasMeshComp () const |
Checks if the entity has a mesh component. | |
bool | hasTransformComp () const |
Checks if the entity has a transform component. | |
bool | hasRenderComp () const |
Checks if the entity has a render component. | |
bool | hasLightComp () const |
Checks if the entity has a light component. | |
bool | hasScriptComp () const |
Checks if the entity has a script component. | |
void | removeMeshComp () |
Removes the mesh component from the entity. | |
void | addLightComp (LightComponent &&light) |
Adds a LightComponent to the entity. | |
std::optional< LightComponent > & | getLightComp () |
Retrieves the LightComponent of the entity. | |
const std::optional< LightComponent > & | getLightComp () const |
Retrieves the LightComponent of the entity (const version). | |
std::optional< MeshComponent > | getMeshComp () const |
Retrieves the MeshComponent of the entity. | |
Entity (const Entity &other)=default | |
Default copy constructor. | |
Entity (Entity &&other) noexcept=default | |
Default move constructor. | |
Entity & | operator= (const Entity &other)=default |
Default copy assignment operator. | |
Entity & | operator= (Entity &&other) noexcept=default |
Default move assignment operator. | |
Public Attributes | |
size_t | ID |
Friends | |
class | EntityManager |
|
default |
Default copy constructor.
other | The entity to copy. |
|
defaultnoexcept |
Default move constructor.
other | The entity to move. |
void Raftel::Entity::addLightComp | ( | LightComponent && | light | ) |
Adds a LightComponent to the entity.
light | The light component to add. |
void Raftel::Entity::addMeshComp | ( | const std::shared_ptr< Mesh > & | mesh | ) |
Adds a MeshComponent to the entity.
mesh | Shared pointer to the mesh. |
void Raftel::Entity::addRenderComp | ( | RenderComponent && | rend | ) |
Adds a RenderComponent to the entity.
rend | The render component to add. |
void Raftel::Entity::addScriptComp | ( | ScriptComponent && | script | ) |
Adds a ScriptComponent to the entity.
script | The script component to add. |
void Raftel::Entity::addTransformComp | ( | TransformComponent && | trans | ) |
Adds a TransformComponent to the entity.
trans | The transform component to add. |
std::optional< LightComponent > & Raftel::Entity::getLightComp | ( | ) |
Retrieves the LightComponent of the entity.
const std::optional< LightComponent > & Raftel::Entity::getLightComp | ( | ) | const |
Retrieves the LightComponent of the entity (const version).
std::optional< MeshComponent > Raftel::Entity::getMeshComp | ( | ) | const |
Retrieves the MeshComponent of the entity.
std::optional< ScriptComponent > & Raftel::Entity::getScriptComp | ( | ) |
Retrieves the ScriptComponent of the entity.
std::optional< TransformComponent > & Raftel::Entity::getTransformComp | ( | ) |
Retrieves the TransformComponent of the entity.
const std::optional< TransformComponent > & Raftel::Entity::getTransformComp | ( | ) | const |
Retrieves the TransformComponent of the entity (const version).
bool Raftel::Entity::hasLightComp | ( | ) | const |
Checks if the entity has a light component.
bool Raftel::Entity::hasMeshComp | ( | ) | const |
Checks if the entity has a mesh component.
bool Raftel::Entity::hasRenderComp | ( | ) | const |
Checks if the entity has a render component.
bool Raftel::Entity::hasScriptComp | ( | ) | const |
Checks if the entity has a script component.
bool Raftel::Entity::hasTransformComp | ( | ) | const |
Checks if the entity has a transform component.
Default copy assignment operator.
other | The entity to copy. |
Default move assignment operator.
other | The entity to move. |
|
friend |