|
VoltMod
C++23 framework for CS2 server plugins
|
One-shot delays and repeating timers, run on the game thread. More...
#include <Scheduler.hpp>
Public Member Functions | |
| Scheduler ()=default | |
| Subscription | Delay (int64_t delayMs, std::function< void()> callback) |
| Subscription | Repeat (int64_t intervalMs, std::function< void()> callback) |
| Subscription | NextTick (std::function< void()> callback) |
| Subscription | EveryFrame (std::function< void()> callback) |
| void | OnGameFrame () |
One-shot delays and repeating timers, run on the game thread.
Dropping a registration's Subscription cancels its timer, one-shots included, so a callback never outlives the state it captured.
Definition at line 17 of file Scheduler.hpp.
|
default |
| Subscription VoltMod::Scheduler::Delay | ( | int64_t | delayMs, |
| std::function< void()> | callback | ||
| ) |
Run callback once after delayMs milliseconds.
Definition at line 20 of file Scheduler.cpp.
References VoltMod::ReadFile().
Referenced by VoltMod::ChatInput::BeginCapture(), NextTick(), and VoltMod::Vote::Start().
| Subscription VoltMod::Scheduler::EveryFrame | ( | std::function< void()> | callback | ) |
Run callback every game frame.
Definition at line 35 of file Scheduler.cpp.
References VoltMod::ReadFile().
Referenced by VoltMod::Database::Connect().
| Subscription VoltMod::Scheduler::NextTick | ( | std::function< void()> | callback | ) |
Run callback on the very next game frame.
Definition at line 30 of file Scheduler.cpp.
References Delay(), and VoltMod::ReadFile().
| void VoltMod::Scheduler::OnGameFrame | ( | ) |
Called every frame by the runtime.
Definition at line 41 of file Scheduler.cpp.
References VoltMod::CallbackRegistry< T >::DispatchIf(), VoltMod::CallbackRegistry< T >::Find(), VoltMod::ReadFile(), and VoltMod::CallbackRegistry< T >::Remove().
Referenced by VoltMod::Runtime::OnGameFrame().
| Subscription VoltMod::Scheduler::Repeat | ( | int64_t | intervalMs, |
| std::function< void()> | callback | ||
| ) |
Run callback every intervalMs milliseconds.
Definition at line 25 of file Scheduler.cpp.
References VoltMod::ReadFile().
Referenced by VoltMod::CenterHtml::Show().