TimerManager.ixx File
Manager for game timers and timer command handling. More...
Included Headers
#include <cassert>
#include <memory>
#include <span>
#include <vector>
#include <stdexcept>
#include <ranges>
#include <helios.engine.util.Guid>
#include <helios.engine.core.types>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.runtime.timing.types.TimerId>
#include <helios.engine.runtime.timing.Timer>
#include <helios.engine.runtime.world.tags.ManagerRole>
#include <helios.engine.runtime.messaging.command.CommandHandlerRegistry>
#include <helios.engine.runtime.timing.commands>
#include <helios.engine.runtime.timing.types>
Namespaces Index
| namespace | helios |
| namespace | engine |
| namespace | runtime |
| namespace | timing |
Classes Index
| class | TimerManager |
|
Manager that owns game timers and processes timer control commands. More... | |
Description
Manager for game timers and timer command handling.
File Listing
The file content with the documentation metadata removed is:
30using namespace helios::engine::runtime::timing::commands;
31using namespace helios::engine::runtime::timing::types;
32using namespace helios::engine::runtime::timing::types;
33using namespace helios::engine::runtime::world;
34export namespace helios::engine::runtime::timing {
47 class TimerManager {
67 return getTimer(timerId) != nullptr;
79 timers_.emplace_back(Timer(timerId));
97 assert(!has(timerId) && "Timer with TimerId already registered");
110 const auto timerIt = std::ranges::find_if(
112 [&](const auto& timer) {
113 return timer.timerId() == timerId;
116 if (timerIt == timers_.end()) {
119 return &*timerIt;
144 for (const auto& controlContext : pendingControlContexts_) {
145 auto* timer = getTimer(controlContext.timerId);
146 if (timer) {
147 if (controlContext.resetElapsed) {
148 timer->reset(controlContext.timerState);
150 timer->setState(controlContext.timerState);
164 bool submit(const TimerControlCommand timerControlCommand) noexcept {
165 pendingControlContexts_.push_back(timerControlCommand.timerControlContext());
174 void init(helios::engine::runtime::messaging::command::CommandHandlerRegistry& commandHandlerRegistry) {
175 commandHandlerRegistry.registerHandler<TimerControlCommand>(*this);
182 for (auto& timer : timers_) {
183 timer.reset();
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.