r5sdk/r5dev/engine/framelimit.h
Kawe Mazidjatari 609d705a0c Tier1: static construction of ConVar objects during link time
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project.

This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console).

Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
2024-04-05 18:13:32 +02:00

27 lines
604 B
C++

#ifndef FRAMELIMIT_H
#define FRAMELIMIT_H
//-----------------------------------------------------------------------------
// RenderThread frame limiter
//-----------------------------------------------------------------------------
class CFrameLimit
{
public:
CFrameLimit(void);
void Reset(const double target);
void Run(const double targetFps, const double sleepThreshold, const double maxTolerance);
private:
double m_MilliSeconds;
double m_FramesPerSecond;
LARGE_INTEGER m_Start;
LARGE_INTEGER m_Next;
LARGE_INTEGER m_Time;
uint32_t m_Frames;
bool m_bRestart;
};
#endif // FRAMELIMIT_H