* Add newlines at the end of files.
[matthijs/ABM2.git] / ABM2 / Engine / GlobalTimer.cpp
1 // GlobalTimer.cpp: implementation of the CGlobalTimer class.\r
2 //\r
3 //////////////////////////////////////////////////////////////////////\r
4 \r
5 #include "engine.h"\r
6 #include "GlobalTimer.h"\r
7 \r
8 //////////////////////////////////////////////////////////////////////\r
9 // Construction/Destruction\r
10 //////////////////////////////////////////////////////////////////////\r
11 \r
12 float CGlobalTimer::dT=0;\r
13 unsigned long CGlobalTimer::lastFrameIndex=0;\r
14 unsigned long CGlobalTimer::thisFrameIndex=0;\r
15 \r
16 CGlobalTimer::CGlobalTimer()\r
17 {\r
18 \r
19 }\r
20 \r
21 CGlobalTimer::~CGlobalTimer()\r
22 {\r
23 \r
24 }\r
25 \r
26 bool CGlobalTimer::Start()\r
27 {\r
28         thisFrameIndex=GetTickCount();\r
29         lastFrameIndex=thisFrameIndex;\r
30         dT=0;\r
31         return true;\r
32 }\r
33 \r
34 void CGlobalTimer::Update()\r
35 {\r
36         lastFrameIndex=thisFrameIndex;\r
37         thisFrameIndex=GetTickCount();\r
38         dT=((float)(thisFrameIndex-lastFrameIndex))/1000.0f;\r
39 }\r
40 \r
41 void CGlobalTimer::Stop()\r
42 {\r
43 \r
44 }\r