Skip to main content

TimerUpdateSystem.ixx File

System that advances all game timers each frame. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespacetiming
namespacesystems

Classes Index

classTimerUpdateSystem<TCommandBuffer>

Updates all game timers managed by the TimerManager. More...

Description

System that advances all game timers each frame.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <span>
8
9export module helios.engine.runtime.timing.systems.TimerUpdateSystem;
10
11import helios.engine.runtime.timing.Timer;
12import helios.engine.runtime.timing.TimerManager;
13
14
15import helios.engine.runtime.world.UpdateContext;
16import helios.engine.runtime.messaging.command.NullCommandBuffer;
17import helios.engine.runtime.messaging.command.concepts.IsCommandBufferLike;
18
19import helios.engine.runtime.world.tags.SystemRole;
20
21import helios.engine.runtime.timing.types;
22import helios.engine.runtime.timing.commands;
23
25
30using namespace helios::engine::runtime::messaging::command::concepts;
31
33
43 template<typename TCommandBuffer = NullCommandBuffer>
46
50 TimerManager& timerManager_;
51
52 public:
53
54
57
58
65 : timerManager_(timerManager) {}
66
73
74 for (auto& timer : timerManager_.timers()) {
75 if (timer.state() == TimerState::Running) {
76
77 timer.update(updateContext.deltaTime());
78
79 if (timer.duration() != 0.0f && timer.elapsed() >= timer.duration()) {
80 auto context = TimerControlContext{timer.timerId(), TimerState::Finished};
82 }
83 }
84 }
85 }
86
87 };
88
89}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.