Skip to main content

Manager.ixx File

Abstract base class for game world managers. 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...

namespaceworld

World state management and per-frame update context. More...

Classes Index

classManager

Abstract base class for managers that process deferred operations. More...

Description

Abstract base class for game world managers.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Manager.ixx
3 * @brief Abstract base class for game world managers.
4 */
5module;
6
7
8export module helios.engine.runtime.world.Manager;
9
10import helios.engine.runtime.world.UpdateContext;
11
12export namespace helios::engine::runtime::world {
13
14 class GameWorld;
15
16 /**
17 * @brief Abstract base class for managers that process deferred operations.
18 *
19 * @details Managers handle cross-cutting concerns that require deferred processing
20 * separate from the System update cycle. They are registered with the GameWorld
21 * and receive lifecycle callbacks for initialization and per-frame flushing.
22 *
23 * ## Lifecycle
24 *
25 * 1 **Registration:** Manager is added via `GameWorld::addManager<T>()`
26 * 2 **onAdd():** Called immediately after registration
27 * 3 **init():** Called during GameWorld initialization (before game loop starts)
28 * 4 **flush():** Called each frame after Systems complete, to process queued requests
29 *
30 * ## Use Cases
31 *
32 * - **GameObjectPoolManager:** Manages entity pooling and acquire/release lifecycle
33 * - **SpawnManager:** Handles spawn request processing and entity initialization
34 * - **Custom Managers:** Any deferred processing that doesn't fit the System model
35 *
36 * Example implementation:
37 * ```cpp
38 * class MyManager : public Manager {
39 * public:
40 * void init(GameWorld& gw) override { ... }
41 * void flush(GameWorld& gw, UpdateContext& ctx) noexcept override {
42 * // Process queued requests
43 * }
44 * };
45 * ```
46 *
47 * @see GameWorld
48 * @see GameObjectPoolManager
49 * @see System
50 */
51 class Manager {
52
53 protected:
54
55 /**
56 * @brief Pointer to the owning GameWorld.
57 *
58 * @details Set during onAdd() and remains valid for the Manager's lifetime.
59 */
61
62 public:
63
64 virtual ~Manager() = default;
65
66 /**
67 * @brief Called when the manager is added to a GameWorld.
68 *
69 * @details Stores a reference to the GameWorld for later use.
70 * Override to perform additional registration logic.
71 *
72 * @param gameWorld The GameWorld this manager was added to.
73 */
75 gameWorld_ = &gameWorld;
76 }
77
78 /**
79 * @brief Initializes the manager before the game loop starts.
80 *
81 * @details Override to perform one-time setup such as pool retrieval,
82 * handler registration, or resource allocation.
83 *
84 * @param gameWorld The GameWorld to initialize with.
85 */
86 virtual void init(
88 ) {
89 // template method
90 };
91
92 /**
93 * @brief Processes queued requests each frame.
94 *
95 * @details Called during the game loop's manager flush phase, after all
96 * Systems have completed their updates. Override to process any queued
97 * operations (spawn requests, despawn requests, etc.).
98 *
99 * @param gameWorld The GameWorld for entity access.
100 * @param update_context The current frame's update context.
101 */
102 virtual void flush(
105 ) noexcept = 0;
106 };
107
108
109}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.