Skip to main content

GameTimerClearSystem.ixx File

System that resets finished game timers each frame. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

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

namespacemechanics

High-level gameplay systems and components for game logic. More...

namespacetiming

Game timer management system. More...

namespacesystems

Systems for the timing module. More...

Classes Index

classGameTimerClearSystem

Resets finished game timers to an undefined state. More...

Description

System that resets finished game timers each frame.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file GameTimerClearSystem.ixx
3 * @brief System that resets finished game timers each frame.
4 */
5module;
6
7
8export module helios.engine.mechanics.timing.systems.GameTimerClearSystem;
9
10import helios.engine.mechanics.timing.GameTimer;
11import helios.engine.mechanics.timing.TimerManager;
12
13import helios.engine.runtime.world.UpdateContext;
14
15import helios.engine.common.tags.SystemRole;
16
17import helios.engine.mechanics.timing.types;
18
20
22
24
25 /**
26 * @brief Resets finished game timers to an undefined state.
27 *
28 * @details Each frame, this system iterates over all registered timers
29 * and resets any timer whose state is `TimerState::Finished` back to
30 * `TimerState::Undefined`. This ensures that one-shot timer completions
31 * are consumed within a single frame and do not trigger downstream
32 * logic more than once.
33 *
34 * @see TimerManager
35 * @see GameTimer
36 */
38
39 /**
40 * @brief Reference to the TimerManager owning the timers.
41 */
42 TimerManager& timerManager_;
43
44 public:
45
46
48
49 /**
50 * @brief Constructs the system with a reference to the TimerManager.
51 *
52 * @param timerManager The manager whose timers are cleared.
53 */
54 explicit GameTimerClearSystem(TimerManager& timerManager)
55 : timerManager_(timerManager) {}
56
57 /**
58 * @brief Resets all finished timers to TimerState::Undefined.
59 *
60 * @param updateContext The current frame's update context.
61 */
63
64 for (auto& gameTimer : timerManager_.gameTimers()) {
65 if (gameTimer.state() == TimerState::Finished || gameTimer.state() == TimerState::Cancelled) {
66 gameTimer.setState(TimerState::Undefined);
67 }
68 }
69 }
70
71 };
72
73}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.