TimerManager Class
Manager that owns game timers and processes timer control commands. More...
Declaration
Public Member Typedefs Index
| using | EngineRoleTag = helios::engine::common::tags::ManagerRole |
Public Member Functions Index
| GameTimer & | addGameTimer (GameTimerId gameTimerId) noexcept |
|
Registers a new game timer. More... | |
| GameTimer * | gameTimer (const GameTimerId gameTimerId) noexcept |
|
Returns a pointer to the timer with the given id. More... | |
| std::span< GameTimer > | gameTimers () noexcept |
|
Returns a span over all registered timers. More... | |
| void | flush (helios::engine::runtime::world::UpdateContext &updateContext) noexcept |
|
Applies all pending timer control contexts. More... | |
| bool | submit (const TimerControlCommand timerControlCommand) noexcept |
|
Enqueues a timer control command for deferred processing. More... | |
| void | init (helios::engine::runtime::world::GameWorld &gameWorld) |
|
Registers this manager as the timer command handler in the game world. More... | |
| void | reset () |
|
Resets all managed timers. More... | |
Private Member Functions Index
| bool | has (const GameTimerId timerId) noexcept |
|
Checks whether a timer with the given id exists. More... | |
| GameTimer * | getGameTimer (const GameTimerId timerId) |
|
Looks up a timer by its id. More... | |
| GameTimer & | add (const GameTimerId gameTimerId) noexcept |
|
Creates and appends a new timer. More... | |
Private Member Attributes Index
| std::vector< GameTimer > | gameTimers_ |
|
Collection of game timers managed by this manager. More... | |
| std::vector< TimerControlContext > | pendingControlContexts_ |
|
Pending timer control contexts to be applied during flush. More... | |
Description
Manager that owns game timers and processes timer control commands.
Pending control commands are collected via submit() and applied during flush() at the beginning of each frame.
- See Also
- See Also
TimerCommandHandler
- See Also
Definition at line 50 of file TimerManager.ixx.
Public Member Typedefs
EngineRoleTag
|
Definition at line 107 of file TimerManager.ixx.
Public Member Functions
addGameTimer()
| inline noexcept |
Registers a new game timer.
Asserts that no timer with the given id already exists.
- Parameters
-
gameTimerId The unique id for the new timer.
- Returns
Reference to the newly created GameTimer.
Definition at line 118 of file TimerManager.ixx.
flush()
| inline noexcept |
Applies all pending timer control contexts.
For each pending context, the corresponding timer's state is updated. The pending list is cleared after processing.
- Parameters
-
gameWorld Reference to the game world.
updateContext Reference to the current update context.
Definition at line 153 of file TimerManager.ixx.
Reference gameTimer.
gameTimer()
| inline nodiscard noexcept |
Returns a pointer to the timer with the given id.
- Parameters
-
gameTimerId The id to look up.
- Returns
Pointer to the GameTimer, or nullptr if not found.
Definition at line 131 of file TimerManager.ixx.
gameTimers()
| inline nodiscard noexcept |
Returns a span over all registered timers.
- Returns
A span of GameTimer instances.
Definition at line 140 of file TimerManager.ixx.
init()
| inline |
Registers this manager as the timer command handler in the game world.
- Parameters
-
gameWorld The game world to register with.
Definition at line 187 of file TimerManager.ixx.
reset()
| inline |
submit()
| inline noexcept |
Enqueues a timer control command for deferred processing.
- Parameters
-
timerControlCommand The command to enqueue.
- Returns
True if the command was accepted.
Definition at line 177 of file TimerManager.ixx.
Private Member Functions
add()
| inline noexcept |
Creates and appends a new timer.
- Parameters
-
gameTimerId The id for the new timer.
- Returns
Reference to the newly created timer.
Definition at line 100 of file TimerManager.ixx.
getGameTimer()
| inline |
Looks up a timer by its id.
- Parameters
-
timerId The id to search for.
- Returns
Pointer to the timer, or nullptr if not found.
Definition at line 80 of file TimerManager.ixx.
has()
| inline nodiscard noexcept |
Checks whether a timer with the given id exists.
- Parameters
-
timerId The id to look up.
- Returns
True if a timer with the given id is registered.
Definition at line 69 of file TimerManager.ixx.
Private Member Attributes
gameTimers_
|
Collection of game timers managed by this manager.
Definition at line 55 of file TimerManager.ixx.
pendingControlContexts_
|
Pending timer control contexts to be applied during flush.
Definition at line 60 of file TimerManager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.