|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
The entity class is the base class of everything which is attached to a scene. If it is part of a scene it is an entity. More...
#include <Entity.h>
Public Member Functions | |
| Entity () | |
| ~Entity () override | |
| void | enableTick (bool enable) |
| Enables or disables ticking for this entity. | |
| void | setTickPriority (int32_t priority) |
| int32_t | getTickPriority () const |
| void | tick (double deltaTime) override |
| Executes every frame if tick is enabled. | |
| template<typename T, typename... Args> requires std::is_base_of_v<Components::Logic, T> | |
| T * | addComponent (Args &&... args) |
| Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool IsUnique = true;'. | |
| template<typename T> requires std::is_base_of_v<Components::Logic, T> | |
| T * | getComponent () const |
| Returns the first component of type T found. | |
| template<typename T> requires std::is_base_of_v<Components::Logic, T> | |
| std::vector< T * > | getComponents () const |
| Returns all components of type T. | |
| void | removeComponent (Components::Logic *component) |
| Removes a specific component instance. | |
| template<typename T> requires std::is_base_of_v<Components::Logic, T> | |
| bool | removeFirstComponent () |
| Removes the first component of type T found. | |
| template<typename T> requires std::is_base_of_v<Components::Logic, T> | |
| bool | hasComponent () const |
| Checks if a component of type T exists. | |
| const std::vector< std::unique_ptr< Components::Logic > > & | getAllComponents () const |
| Gets all components on this entity. | |
| bool | canTick () const |
| Tells you if the entity can execute its tick function. | |
| bool | canEverTick () const |
| Tells if this entity can ever tick. | |
| entt::entity | getEcsEntity () const |
| Gets the ECS entity handle for this Entity. | |
| Public Member Functions inherited from Engine::Core::ITickable | |
| virtual | ~ITickable ()=default |
| virtual void | preTick () |
| Function which executes immediately before the execution of ITickable::preTick() | |
| virtual void | postTick () |
| Function which executes immediately after the execution of ITickable::postTick() | |
Protected Member Functions | |
| uuids::uuid | getUUID () const |
| Getter for the UUID of this entity. | |
| std::string | getUuidString () const |
| Getter for the UUID of this entity as a string. | |
Protected Attributes | |
| std::vector< std::unique_ptr< Components::Logic > > | components_ |
| List of all logical components. | |
| entt::entity | data_ = entt::null |
| bool | allowTicking_ = false |
| int32_t | tickPriority_ = 0 |
Private Attributes | |
| uuids::uuid | uuid_ |
The entity class is the base class of everything which is attached to a scene. If it is part of a scene it is an entity.
| Engine::Entities::Entity::Entity | ( | ) |
|
override |
|
inline |
Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool IsUnique = true;'.
| T | The type of component to add (must derive from LogicComponent). |
| Args | Arguments to forward to the component constructor. |
Definition at line 45 of file Entity.h.
References components_, and getComponent().
|
nodiscard |
Tells if this entity can ever tick.
|
nodiscard |
Tells you if the entity can execute its tick function.
| void Engine::Entities::Entity::enableTick | ( | bool | enable | ) |
Enables or disables ticking for this entity.
| enable | disable or enable ticking |
|
inlinenodiscard |
Gets all components on this entity.
Definition at line 148 of file Entity.h.
References components_.
|
inline |
Returns the first component of type T found.
Definition at line 75 of file Entity.h.
References components_.
Referenced by addComponent(), and hasComponent().
|
inline |
Returns all components of type T.
Definition at line 90 of file Entity.h.
References components_.
|
inlinenodiscard |
|
inlinenodiscard |
Definition at line 28 of file Entity.h.
References tickPriority_.
|
inlineprotected |
|
protected |
Getter for the UUID of this entity as a string.
|
inline |
Checks if a component of type T exists.
Definition at line 140 of file Entity.h.
References getComponent().
|
inline |
Removes a specific component instance.
| component | Pointer to the component to remove. |
Definition at line 104 of file Entity.h.
References components_.
|
inline |
Removes the first component of type T found.
Definition at line 121 of file Entity.h.
References components_.
| void Engine::Entities::Entity::setTickPriority | ( | int32_t | priority | ) |
|
overridevirtual |
Executes every frame if tick is enabled.
| deltaTime | time between the last frame and this frame |
Reimplemented from Engine::Core::ITickable.
|
protected |
|
protected |
List of all logical components.
Definition at line 186 of file Entity.h.
Referenced by addComponent(), getAllComponents(), getComponent(), getComponents(), removeComponent(), and removeFirstComponent().
|
protected |
Definition at line 188 of file Entity.h.
Referenced by getEcsEntity().
|
protected |
Definition at line 191 of file Entity.h.
Referenced by getTickPriority().
|
private |