Skip to main content

System.ixx File

Base class for game systems that operate on the GameWorld. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

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

namespaceecs

Core Entity-Component-System architecture. More...

Classes Index

classSystem

Abstract base class for game systems. More...

Description

Base class for game systems that operate on the GameWorld.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file System.ixx
3 * @brief Base class for game systems that operate on the GameWorld.
4 */
5module;
6
7
8export module helios.engine.ecs.System;
9
10import helios.engine.ecs.Updatable;
11
12export namespace helios::engine::ecs {
13
14 class GameWorld;
15
16 /**
17 * @brief Abstract base class for game systems.
18 *
19 * @details Systems are global game logic processors that operate on the GameWorld
20 * rather than individual GameObjects, ideal for cross-cutting concerns
21 * like physics simulation, collision detection, or object pooling.
22 *
23 * Systems are added to a GameWorld and receive update calls each frame.
24 * The `onAdd()` callback provides access to the GameWorld for initialization.
25 *
26 * Example usage:
27 * ```cpp
28 * class PhysicsSystem : public System {
29 * public:
30 * void update(UpdateContext& ctx) noexcept override {
31 * // Apply physics to all rigid bodies
32 * }
33 * };
34 *
35 * gameWorld.addSystem(std::make_unique<PhysicsSystem>());
36 * ```
37 */
39
40 protected:
41
42 /**
43 * @brief Pointer to the GameWorld this system belongs to.
44 *
45 * @details Set by `onAdd()` when the system is registered with a GameWorld.
46 * Non-owning pointer; valid for the lifetime of the system.
47 */
49
50 public:
51
52 /**
53 * @brief Virtual destructor for proper cleanup of derived systems.
54 */
55 virtual ~System() = default;
56
57 /**
58 * @brief Called when the system is initialized by the GameWorld.
59 *
60 * @details Override this method to perform initialization that requires
61 * access to the GameWorld (e.g., querying the scene graph, registering
62 * event handlers).
63 *
64 * @param gameWorld The GameWorld this system is being added to.
65 *
66 * @deprected use init
67 */
68 virtual void init(helios::engine::runtime::world::GameWorld& gameWorld) noexcept {
69 gameWorld_ = &gameWorld;
70 }
71
72
73
74 /**
75 * @brief Updates the system each frame.
76 *
77 * @param updateContext The update context containing frame timing information.
78 */
79 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override = 0;
80
81 };
82
83
84}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.