VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::Scheduler Class Reference

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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Scheduler()

VoltMod::Scheduler::Scheduler ( )
default

Member Function Documentation

◆ Delay()

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().

◆ EveryFrame()

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().

◆ NextTick()

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().

◆ OnGameFrame()

void VoltMod::Scheduler::OnGameFrame ( )

◆ Repeat()

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().


The documentation for this class was generated from the following files: