31 QueryPerformanceFrequency(&l);
32 invFreq = 1.0f / l.QuadPart;
44 QueryPerformanceCounter(&l);
45 resetStamp = (((double)l.QuadPart) * invFreq);
48 float Timer::getTime()
51 QueryPerformanceCounter(&l);
52 return (
float)(((double)l.QuadPart) * invFreq - resetStamp);
55 float Timer::getInterval()
57 float time = getTime();
58 float interval = time - lastInterval;
65 float time = getTime();
67 if (time-lastFpsUpdate > 1.0
f)
69 fps = (
float)frameCount / (time-lastFpsUpdate);
85 , lastIntervalTime(0.0
f)
112 return seconds + milliseconds;
119 lastIntervalTime =
time;
Timer()
Default Constructor.
float getTime()
Returns the time passed since object creation or since reset() was last called.
float getFPS()
Returns the FPS (Frames Per Second).
void reset()
Resets the timer to 0.0f.
float getInterval()
Returns the time passed since getInterval() was last called.
bool isTimePassed(float seconds=1.0f)
Tests if 'seconds' seconds have passed since reset() or this method was called.