Skip to main content

GameTimerBindingComponent.ixx File

Component that observes a specific game timer. 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...

namespacecomponents

ECS components for the timing module. More...

Classes Index

classGameTimerBindingComponent

Component that tracks the revision of a specific GameTimer. More...

Description

Component that observes a specific game timer.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file GameTimerBindingComponent.ixx
3 * @brief Component that observes a specific game timer.
4 */
5module;
6
7export module helios.engine.mechanics.timing.components.GameTimerBindingComponent;
8
9import helios.engine.mechanics.timing.types;
10
11import helios.engine.mechanics.timing.types.GameTimerId;
12import helios.core.types;
13
16
18
19 /**
20 * @brief Component that tracks the revision of a specific GameTimer.
21 *
22 * Entities with this component observe a GameTimer identified by its
23 * GameTimerId. The stored revision can be compared against the timer's
24 * current revision to detect updates.
25 *
26 * @see GameTimer
27 * @see GameTimerUpdateSystem
28 */
30
31 private:
32
33 /**
34 * @brief The id of the observed game timer.
35 */
36 GameTimerId gameTimerId_;
37
38 /**
39 * @brief Last known revision of the observed timer.
40 */
41 TimerRevision timerRevision_;
42
43
44 public:
45
46
48
49 /**
50 * @brief Copy constructor.
51 *
52 * @param other The component to copy from.
53 */
55 gameTimerId_(other.gameTimerId_) {}
56
59 GameTimerBindingComponent& operator=(GameTimerBindingComponent&&) noexcept = default;
60
61 /**
62 * @brief Sets the id of the game timer to observe.
63 *
64 * @param gameTimerId The timer id.
65 */
67 gameTimerId_ = gameTimerId;
68 }
69
70 /**
71 * @brief Returns the observed game timer id.
72 *
73 * @return The GameTimerId.
74 */
76 return gameTimerId_;
77 }
78
79 /**
80 * @brief Sets the last known timer revision.
81 *
82 * If the new revision differs from the stored one, the update flag
83 * is set so that consuming systems can detect the change.
84 *
85 * @param timerRevision The revision value.
86 */
88 if (timerRevision_ == timerRevision) {
89 return;
90 }
91 timerRevision_ = timerRevision;
92 }
93
94 /**
95 * @brief Returns the last known timer revision.
96 *
97 * @return The stored TimerRevision.
98 */
99 [[nodiscard]] TimerRevision timerRevision() const noexcept {
100 return timerRevision_;
101 }
102
103 };
104
105
106}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.