VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Clock.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
VoltMod/Engine/EngineTypes.hpp
>
4
#include <
VoltMod/Engine/Interfaces.hpp
>
5
6
namespace
VoltMod
7
{
8
9
/**
10
* @brief The engine's simulation clock, read straight from IVEngineServer2::GetServerGlobals().
11
*
12
* Holds no state of its own - every call reads the engine live. It is the timestamp source for
13
* anything that must line up with the tick the engine is simulating. Both readings reset when a
14
* map starts, so never persist a value across a map change.
15
*
16
* Exposed as `runtime.Clock`.
17
*/
18
class
Clock
19
{
20
public
:
21
/** @p interfaces supplies IVEngineServer2; it must outlive this service. */
22
explicit
Clock
(
Interfaces
& interfaces);
23
Clock
(
const
Clock
&) =
delete
;
24
Clock
&
operator=
(
const
Clock
&) =
delete
;
25
26
/** The engine's CGlobalVars, or nullptr before load / after shutdown. */
27
CGlobalVars*
Globals
()
const
;
28
29
/** Current simulation tick (`tickcount`), or 0 when the globals are unavailable. */
30
int
Tick
()
const
;
31
32
/** Current simulation time in seconds (`curtime`), or 0 when the globals are unavailable. */
33
float
Time
()
const
;
34
35
private
:
36
Interfaces
& _interfaces;
37
};
38
39
}
// namespace VoltMod
EngineTypes.hpp
Interfaces.hpp
VoltMod::Clock::Clock
Clock(const Clock &)=delete
VoltMod::Clock::operator=
Clock & operator=(const Clock &)=delete
VoltMod::Clock::Time
float Time() const
Definition
Clock.cpp:21
VoltMod::Clock::Tick
int Tick() const
Definition
Clock.cpp:15
VoltMod::Clock::Clock
Clock(Interfaces &interfaces)
Definition
Clock.cpp:8
VoltMod::Clock::Globals
CGlobalVars * Globals() const
Definition
Clock.cpp:10
VoltMod
Definition
Options.hpp:13
VoltMod::Interfaces
Centralized holder for all SDK interface pointers.
Definition
Interfaces.hpp:19
include
VoltMod
Engine
Server
Clock.hpp
Generated by
1.15.0