-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameTimer.h
34 lines (26 loc) · 862 Bytes
/
GameTimer.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
//***************************************************************************************
// GameTimer.h by Frank Luna (C) 2011 All Rights Reserved.
//***************************************************************************************
#ifndef GAMETIMER_H
#define GAMETIMER_H
class GameTimer
{
public:
GameTimer();
float TotalTime()const; // 总游戏时间
float DeltaTime()const; // 帧间隔时间
void Reset(); // 在消息循环之前调用
void Start(); // 在取消暂停的时候调用
void Stop(); // 在暂停的时候调用
void Tick(); // 在每一帧的时候调用
private:
double m_SecondsPerCount;
double m_DeltaTime;
__int64 m_BaseTime;
__int64 m_PausedTime;
__int64 m_StopTime;
__int64 m_PrevTime;
__int64 m_CurrTime;
bool m_Stopped;
};
#endif // GAMETIMER_H