Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::Entity Class Reference

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< MeshComponentgetMeshComp () const
 Retrieves the MeshComponent of the entity.
 
 Entity (const Entity &other)=default
 Default copy constructor.
 
 Entity (Entity &&other) noexcept=default
 Default move constructor.
 
Entityoperator= (const Entity &other)=default
 Default copy assignment operator.
 
Entityoperator= (Entity &&other) noexcept=default
 Default move assignment operator.
 

Public Attributes

size_t ID
 

Friends

class EntityManager
 

Detailed Description

Represents an entity in the ECS (Entity Component System).

Definition at line 28 of file ecs.hpp.

Constructor & Destructor Documentation

◆ Entity() [1/2]

Raftel::Entity::Entity ( const Entity & other)
default

Default copy constructor.

Parameters
otherThe entity to copy.

◆ Entity() [2/2]

Raftel::Entity::Entity ( Entity && other)
defaultnoexcept

Default move constructor.

Parameters
otherThe entity to move.

Member Function Documentation

◆ addLightComp()

void Raftel::Entity::addLightComp ( LightComponent && light)

Adds a LightComponent to the entity.

Parameters
lightThe light component to add.

◆ addMeshComp()

void Raftel::Entity::addMeshComp ( const std::shared_ptr< Mesh > & mesh)

Adds a MeshComponent to the entity.

Parameters
meshShared pointer to the mesh.

◆ addRenderComp()

void Raftel::Entity::addRenderComp ( RenderComponent && rend)

Adds a RenderComponent to the entity.

Parameters
rendThe render component to add.

◆ addScriptComp()

void Raftel::Entity::addScriptComp ( ScriptComponent && script)

Adds a ScriptComponent to the entity.

Parameters
scriptThe script component to add.

◆ addTransformComp()

void Raftel::Entity::addTransformComp ( TransformComponent && trans)

Adds a TransformComponent to the entity.

Parameters
transThe transform component to add.

◆ getLightComp() [1/2]

std::optional< LightComponent > & Raftel::Entity::getLightComp ( )

Retrieves the LightComponent of the entity.

Returns
The LightComponent if available.

◆ getLightComp() [2/2]

const std::optional< LightComponent > & Raftel::Entity::getLightComp ( ) const

Retrieves the LightComponent of the entity (const version).

Returns
The LightComponent if available.

◆ getMeshComp()

std::optional< MeshComponent > Raftel::Entity::getMeshComp ( ) const

Retrieves the MeshComponent of the entity.

Returns
The MeshComponent if available.

◆ getScriptComp()

std::optional< ScriptComponent > & Raftel::Entity::getScriptComp ( )

Retrieves the ScriptComponent of the entity.

Returns
The ScriptComponent if available.

◆ getTransformComp() [1/2]

std::optional< TransformComponent > & Raftel::Entity::getTransformComp ( )

Retrieves the TransformComponent of the entity.

Returns
The TransformComponent if available.

◆ getTransformComp() [2/2]

const std::optional< TransformComponent > & Raftel::Entity::getTransformComp ( ) const

Retrieves the TransformComponent of the entity (const version).

Returns
The TransformComponent if available.

◆ hasLightComp()

bool Raftel::Entity::hasLightComp ( ) const

Checks if the entity has a light component.

Returns
True if the entity has a light component, false otherwise.

◆ hasMeshComp()

bool Raftel::Entity::hasMeshComp ( ) const

Checks if the entity has a mesh component.

Returns
True if the entity has a mesh component, false otherwise.

◆ hasRenderComp()

bool Raftel::Entity::hasRenderComp ( ) const

Checks if the entity has a render component.

Returns
True if the entity has a render component, false otherwise.

◆ hasScriptComp()

bool Raftel::Entity::hasScriptComp ( ) const

Checks if the entity has a script component.

Returns
True if the entity has a script component, false otherwise.

◆ hasTransformComp()

bool Raftel::Entity::hasTransformComp ( ) const

Checks if the entity has a transform component.

Returns
True if the entity has a transform component, false otherwise.

◆ operator=() [1/2]

Entity & Raftel::Entity::operator= ( const Entity & other)
default

Default copy assignment operator.

Parameters
otherThe entity to copy.
Returns
Reference to this entity.

◆ operator=() [2/2]

Entity & Raftel::Entity::operator= ( Entity && other)
defaultnoexcept

Default move assignment operator.

Parameters
otherThe entity to move.
Returns
Reference to this entity.

Friends And Related Symbol Documentation

◆ EntityManager

friend class EntityManager
friend

Definition at line 154 of file ecs.hpp.

Member Data Documentation

◆ ID

size_t Raftel::Entity::ID

Unique identifier for the entity.

Definition at line 30 of file ecs.hpp.


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