|
Muto 0.0.1
|
Represents an entity in a scene. More...
#include <Entity.h>
Public Member Functions | |
| template<typename T , typename... Args> | |
| T & | AddComponent (Args &&... args) |
| Adds a component of type T to the entity with the provided arguments Otherwise, asserts if the entity already has the component. | |
| template<typename T , typename... Args> | |
| T & | AddOrReplaceComponent (Args &&... args) |
| Adds or replaces a component of type T to the entity with the provided arguments. | |
| Entity ()=default | |
| Entity (const Entity &other)=default | |
| Copy constructor for Entity. | |
| Entity (entt::entity handle, Scene *scene) | |
| Constructs an Entity with the given handle and scene. | |
| template<typename T > | |
| T & | GetComponent () |
| Retrieves a reference to the component of type T attached to the entity if it exists. Otherwise, asserts. | |
| const UUID & | GetID () |
| Retrieves a const reference to the UUID of the entity. | |
| const std::string & | GetName () |
| Retrieves a const reference to the name of the entity. | |
| template<typename T , typename... Args> | |
| T & | GetOrAddComponent (Args &&... args) |
| Retrieves a reference to the component of type T attached to the entity if it exists. Otherwise, adds the component with the provided arguments and returns it. | |
| template<typename T > | |
| bool | HasComponent () const |
| Checks if the entity has a component of type T. | |
| operator bool () const | |
| operator entt::entity () const | |
| operator uint32_t () const | |
| bool | operator!= (const Entity &other) const |
| bool | operator== (const Entity &other) const |
| template<typename T > | |
| void | RemoveComponent () |
| Removes the component of type T from the entity if it exists. Otherwise, asserts. | |
Private Attributes | |
| entt::entity | m_EntityID {entt::null} |
| The unique identifier of the entity within the scene. | |
| Scene * | m_Scene = nullptr |
| Pointer to the scene that contains the entity. | |
Represents an entity in a scene.
Contains a handle to an entity (entt::entity) in a scene and provides methods to manipulate its components.
|
default |
| Muto::Entity::Entity | ( | entt::entity | handle, |
| Scene * | scene | ||
| ) |
Constructs an Entity with the given handle and scene.
| handle | The handle to the entity. |
| scene | The scene to which the entity belongs. |
References Entity(), and m_Scene.
Referenced by Entity().
Adds a component of type T to the entity with the provided arguments Otherwise, asserts if the entity already has the component.
| T | The type of component to add. |
| Args | The types of arguments to forward to the component's constructor. |
| args | The arguments to forward to the component's constructor. |
References m_Scene.
|
inline |
Adds or replaces a component of type T to the entity with the provided arguments.
| T | The type of component to add or replace. |
| Args | The types of arguments to forward to the component's constructor. |
| args | The arguments to forward to the component's constructor. |
|
inline |
Retrieves a reference to the component of type T attached to the entity if it exists. Otherwise, asserts.
| T | The type of component to retrieve. |
|
inline |
Retrieves a const reference to the name of the entity.
|
inline |
Retrieves a reference to the component of type T attached to the entity if it exists. Otherwise, adds the component with the provided arguments and returns it.
| T | The type of component to add. |
| Args | The types of arguments to forward to the component's constructor. |
| args | The arguments to forward to the component's constructor. |
Checks if the entity has a component of type T.
| T | The type of component to check for. |
|
inline |
|
inline |
|
inline |
Removes the component of type T from the entity if it exists. Otherwise, asserts.
| T | The type of component to remove. |
|
private |
The unique identifier of the entity within the scene.
Pointer to the scene that contains the entity.
Referenced by AddComponent(), and Entity().