GameObjectPoolManager.ixx File
Manager for GameObject pooling and lifecycle management. More...
Included Headers
#include <cassert>
#include <memory>
#include <optional>
#include <stdexcept>
#include <unordered_map>
#include <helios.engine.runtime.pooling.GameObjectPoolSnapshot>
#include <helios.engine.common.tags>
#include <helios.core.types>
#include <helios.engine.ecs.EntityHandle>
#include <helios.engine.runtime.pooling.GameObjectPoolConfig>
#include <helios.engine.runtime.pooling.GameObjectPoolRegistry>
#include <helios.engine.runtime.pooling.components.PrefabIdComponent>
#include <helios.engine.runtime.pooling.GameObjectPool>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.runtime.world.GameWorld>
#include <helios.engine.ecs.GameObject>
#include <helios.engine.runtime.pooling.types.GameObjectPoolId>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | runtime |
|
Runtime infrastructure for game execution and lifecycle orchestration. More... | |
| namespace | pooling |
|
GameObject pooling for efficient object recycling. More... | |
Classes Index
| class | GameObjectPoolManager |
|
High-level manager for GameObject pooling operations. More... | |
Description
Manager for GameObject pooling and lifecycle management.
File Listing
The file content with the documentation metadata removed is:
34export namespace helios::engine::runtime::pooling {
105 class GameObjectPoolManager {
113 helios::engine::runtime::pooling::GameObjectPoolRegistry pools_{};
121 helios::engine::runtime::world::GameWorld* gameWorld_ = nullptr;
154 const helios::engine::runtime::pooling::types::GameObjectPoolId gameObjectPoolId,
155 helios::engine::ecs::GameObject gameObjectPrefab
157 helios::engine::ecs::EntityHandle entityHandle{};
159 auto* gameObjectPool = pool(gameObjectPoolId);
165 helios::engine::ecs::GameObject go = gameWorld_->clone(gameObjectPrefab);
166 go.setActive(false);
167 go.onRelease();
168 gameObjectPool->addInactive(go.entityHandle());
189 GameObjectPoolManager& addPoolConfig(std::unique_ptr<GameObjectPoolConfig> gameObjectPoolConfig) {
211 const helios::engine::runtime::pooling::types::GameObjectPoolId gameObjectPoolId
213 auto* gameObjectPool = pool(gameObjectPoolId);
234 const helios::engine::runtime::pooling::types::GameObjectPoolId gameObjectPoolId,
235 const helios::engine::ecs::EntityHandle& entityHandle
237 auto* gameObjectPool = pool(gameObjectPoolId);
267 const helios::engine::runtime::pooling::types::GameObjectPoolId gameObjectPoolId
269 helios::engine::ecs::EntityHandle entityHandle{};
271 auto* gameObjectPool = pool(gameObjectPoolId);
300 void init(helios::engine::runtime::world::GameWorld& gameWorld) {
306 auto pool = std::make_unique<helios::engine::runtime::pooling::GameObjectPool>(
309 pools_.addPool(gameObjectPoolId, std::move(pool));
311 for (auto [entity, pic] : gameWorld.view<helios::engine::runtime::pooling::components::PrefabIdComponent>().whereEnabled()) {
332 helios::engine::runtime::world::UpdateContext& update_context
346 [[nodiscard]] GameObjectPool* pool(
347 const helios::engine::runtime::pooling::types::GameObjectPoolId gameObjectPoolId
367 reset(poolId);
380 void reset(const types::GameObjectPoolId poolId) {
382 const auto poolPtr = pool(poolId);
387 release(poolId, entityHandle);
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.