Entity.ixx File
High-level facade for entity manipulation in the ECS. More...
Included Headers
#include <cassert>
#include <utility>
#include <helios.ecs.concepts.Traits>
#include <helios.ecs.types.ComponentTypeId>
#include <helios.ecs.commands>
#include <helios.ecs.ComponentOpsRegistry>
#include <helios.ecs.components>
#include <helios.ecs.EntityManager>
#include <helios.ecs.types.EntityHandle>
Namespaces Index
| namespace | helios |
| namespace | ecs |
Classes Index
| class | Entity<TEntityManager> |
|
Lightweight facade for entity component manipulation. More... | |
Description
High-level facade for entity manipulation in the ECS.
File Listing
The file content with the documentation metadata removed is:
25using namespace helios::ecs::types;
26using namespace helios::ecs::commands;
27using namespace helios::ecs::concepts::traits;
28using namespace helios::ecs::components;
29export namespace helios::ecs {
107 assert((entityManager_->template managesDirty<T>()) && "Cannot mark component as dirty, not tracked by EntityManager." );
115 using Handle_type = TEntityManager::Handle_type;
123 using ActiveComponent_type = Active<Handle_type>;
134 const Handle_type entityHandle,
147 void forEachComponentTypeId(TFunc&& func) const {
156 [[nodiscard]] Handle_type handle() noexcept {
165 [[nodiscard]] Handle_type handle() const noexcept {
196 const auto ops = ComponentOpsRegistry_type::ops(typeId);
197 void* raw = entityManager_->raw(entityHandle_, typeId);
200 ops.onActivate(raw);
202 ops.onDeactivate(raw);
223 buffer.template add<AddComponentCommand<TComponent>>(entityHandle_, std::forward<Args>(args)...);
238 void deferRemove(TBuffer& buffer) {
253 void deferSetActive(TBuffer& buffer) {
254 buffer.template add<ActivateEntityCommand<typename TEntityManager::Handle_type>>(entityHandle_);
268 void deferSetInactive(TBuffer& buffer) {
269 buffer.template add<DeactivateEntityCommand<typename TEntityManager::Handle_type>>(entityHandle_);
301 T& trackDirty(Args&& ...args) {
319 void setTrackedValue(TComponent* component, TValue value) {
337 void setTrackedValue(TComponent* component, const TValue& value) {
363 void* raw(const ComponentTypeId_type typeId) {
410 bool has(ComponentTypeId_type typeId) const noexcept {
419 void enableComponent(const ComponentTypeId_type typeId) {
428 void disableComponent(const ComponentTypeId_type typeId) {
456 const bool isActive = entityManager_->template has<ActiveComponent_type>(entityHandle_);
457 const bool isInActive = !isActive;
459 if (!isActive && active) {
476 [&](const ComponentTypeId_type typeId) {
477 const auto& ops = ComponentOpsRegistry_type::ops(typeId);
480 void* raw = entityManager_->raw(entityHandle_, typeId);
481 ops.onActivate(raw);
483 void* raw = entityManager_->raw(entityHandle_, typeId);
484 ops.onDeactivate(raw);
508 [&](const ComponentTypeId_type typeId) {
509 const auto& ops = ComponentOpsRegistry_type::ops(typeId);
512 void* raw = entityManager_->raw(entityHandle_, typeId);
513 ops.onRelease(raw);
529 [&](const ComponentTypeId_type typeId) {
530 const auto& ops = ComponentOpsRegistry_type::ops(typeId);
533 void* raw = entityManager_->raw(entityHandle_, typeId);
534 ops.onAcquire(raw);
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.