-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGameTimer.h
40 lines (29 loc) · 822 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
35
36
37
38
39
40
//***************************************************************************************
// GameTimer.h by Frank Luna (C) 2011 All Rights Reserved.
//***************************************************************************************
#ifndef GAMETIMER_H
#define GAMETIMER_H
#include <windows.h>
class GameTimer;
extern GameTimer timer;
class GameTimer
{
public:
GameTimer();
float TotalTime()const; // in seconds
float DeltaTime()const; // in seconds
void Reset(); // Call before message loop.
void Start(); // Call when unpaused.
void Stop(); // Call when paused.
void Tick(); // Call every frame.
private:
double mSecondsPerCount;
double mDeltaTime;
__int64 mBaseTime;
__int64 mPausedTime;
__int64 mStopTime;
__int64 mPrevTime;
__int64 mCurrTime;
bool mStopped;
};
#endif // GAMETIMER_H