-
Notifications
You must be signed in to change notification settings - Fork 0
/
Timer.h
35 lines (30 loc) · 681 Bytes
/
Timer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _ctimer_h
#define _ctimer_h
#include "base.h"
class CTimer
{
__int64 m_CurrentTime;
__int64 m_OldTime;
__int64 m_Ticks;
float m_fFPS;
float m_pFPSBuffer[50];
float m_fUpdateInterval;
int m_FPSIndex;
public:
__int64 m_StartTime;
__int64 m_EndTime;
float m_TimeDelta;
int m_FrameCounter;
void StartTimer();
void StopTimer() const;
void SetTrigger(const float seconds) { m_fUpdateInterval = seconds; };
BOOL CheckTrigger();
__int64 GetTime();
float GetTimeDelta();
float GetFPS() const { return m_fFPS; };
float CalcFPS();
float GetTimerDuration() { return (((float)m_EndTime - (float)m_StartTime)/(float)m_Ticks); };
CTimer();
~CTimer();
};
#endif