Engine → ECS → entity_handle.h
entity_handle
| Type | Class |
| Namespace | conjure::ecs |
| Include File Path | engine/include/conjure/ecs/entity_handle.h |
| Source File Path | N/A |
| API ↗ | Entities and components |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | entity_handle() noexcept = default; | A handle to nothing. |
| public | entity_handle(
world &target,
entity id) noexcept; | |
| public | entity_handle(
const entity_handle &) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~entity_handle() = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mEntity | entity | {} | |
| private | mWorld | world * | nullptr |
Functions
Public
add
addtemplate <typename ComponentType> [[nodiscard]] core::result<component_ref<ComponentType>> add(
ComponentType value = {});Adds a component (world::add) and returns a reference to it.
component
componenttemplate <typename ComponentType> [[nodiscard]] component_ref<ComponentType> component() const noexcept;A reference to a component; is_valid() tells whether it exists.
has
hastemplate <typename ComponentType> [[nodiscard]] bool has() const noexcept;True when the entity is alive and holds the component.
is_alive
is_alive[[nodiscard]] bool is_alive() const noexcept;True while the entity is alive.
remove
removetemplate <typename ComponentType> [[nodiscard]] core::result<void> remove();Removes a component (world::remove).
Operator Overloads
Public
operator=
operator=entity_handle &operator=(
const entity_handle &) noexcept = default;operator==
operator==[[nodiscard]] bool operator==(
const entity_handle &other) const noexcept = default;