![]() |
Raven Engine v0.1
|
Lightweight wrapper for manipulating a single entity within the ECS. More...
#include <Entity.h>
Public Member Functions | |
| Entity (Registry &ecs) | |
| Construct a new Entity instance with a fresh UUID. | |
| Entity (Registry &ecs, const UUID &id) | |
| Constructs an Entity with an ID. | |
| Entity (const Entity &other) | |
| Copy constructor for Entity. | |
| Entity & | operator= (const Entity &other) |
| Copy assignment operator. | |
| template<typename T> | |
| void | Add (const T &component) |
| Add a component to this entity. | |
| template<typename T> | |
| void | Remove (const T &component) |
| Remove a component from this entity. | |
| template<typename T> | |
| T * | Get () |
| Retrieve a pointer to a component of type T. | |
| template<typename T> | |
| bool | Has () |
| Check if this entity has a component of type T. | |
| const UUID & | GetID () const |
| Get the unique identifier of this entity. | |
| const usize | GetNumComponents () const |
| Get the number of components attached to this entity. | |
Friends | |
| bool | operator== (const Entity &lhs, const Entity &rhs) |
Lightweight wrapper for manipulating a single entity within the ECS.
Provides an interface to operate on an entity by delegating actions to the underlying Registry, such as adding, removing, checking, or retrieving components.
|
inline |
|
inline |
|
inline |
Add a component to this entity.
| T | Component type. |
| component | The component instance to add. |
|
inline |
Retrieve a pointer to a component of type T.
| T | Component type. |
|
inline |
Get the unique identifier of this entity.
|
inline |
Get the number of components attached to this entity.
|
inline |
Check if this entity has a component of type T.
| T | Component type. |
Copy assignment operator.
Performs a shallow copy of the UUID and registry pointer. This does not clone the entity or its components — only the handle is reassigned. Safe as long as the original registry remains valid.
|
inline |
Remove a component from this entity.
| T | Component type. |
| component | The component instance to remove. |