2023-09-11 22:20:24 +02:00
|
|
|
#ifndef FRAMELIMIT_H
|
|
|
|
#define FRAMELIMIT_H
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// RenderThread frame limiter
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CFrameLimit
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CFrameLimit(void);
|
|
|
|
|
2024-02-24 02:15:09 +01:00
|
|
|
void Reset(const double target);
|
|
|
|
void Run(const double targetFps, const double sleepThreshold, const double maxTolerance);
|
2023-09-11 22:20:24 +02:00
|
|
|
|
|
|
|
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
|