Skip to main content

GameObjectPoolConfig.ixx File

Configuration data for GameObjectPool initialization. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacepooling

GameObject pooling for efficient object recycling. More...

Classes Index

structGameObjectPoolConfig

Configuration structure for creating a GameObjectPool. More...

Description

Configuration data for GameObjectPool initialization.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file GameObjectPoolConfig.ixx
3 * @brief Configuration data for GameObjectPool initialization.
4 */
5module;
6
7#include <memory>
8
9export module helios.engine.runtime.pooling.GameObjectPoolConfig;
10
11import helios.engine.ecs.GameObject;
12import helios.engine.core.data.GameObjectPoolId;
13
15
16 /**
17 * @brief Configuration structure for creating a GameObjectPool.
18 *
19 * @details GameObjectPoolConfig bundles all information required to initialize
20 * a GameObjectPool: a unique identifier, a prefab template for cloning, and
21 * the initial pool size. This configuration is typically passed to the
22 * GameObjectPoolManager responsible for this pool config.
23 *
24 * The prefab serves as the archetype from which all pooled instances are cloned.
25 * Components attached to the prefab will be duplicated to each pooled object.
26 *
27 * Example usage:
28 * ```cpp
29 * // Create prefab via GameWorld
30 * auto enemyPrefab = gameWorld.addGameObject();
31 * enemyPrefab.add<RenderableComponent>(mesh, material);
32 * enemyPrefab.add<Move2DComponent>();
33 * enemyPrefab.add<HealthComponent>(100.0f);
34 * enemyPrefab.setActive(false); // Prefabs should be inactive
35 *
36 * auto config = std::make_unique<GameObjectPoolConfig>(
37 * GameObjectPoolId{1},
38 * enemyPrefab,
39 * 50 // Pre-allocate 50 clones
40 * );
41 *
42 * poolManager.addPoolConfig(std::move(config));
43 * ```
44 *
45 * @see GameObjectPool
46 * @see GameObjectPoolId
47 * @see GameObjectPoolManager
48 */
50
51 /**
52 * @brief Unique identifier for the pool.
53 *
54 * Used to reference and retrieve the pool from registries.
55 */
57
58 /**
59 * @brief Template object used for cloning pooled instances.
60 *
61 * @details The prefab defines the component configuration for all objects
62 * created by this pool. Since GameObject is lightweight (~16 bytes),
63 * it is stored by value. The prefab should be inactive.
64 */
66
67 /**
68 * @brief Initial number of objects to pre-allocate in the pool.
69 *
70 * Determines how many clones of the prefab are created upfront.
71 * Higher values reduce runtime allocations but increase memory usage.
72 */
73 const size_t amount;
74
75 };
76
77}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.