#include <Timer.h>
Public Member Functions | |
Timer () | |
Constructor. | |
~Timer () | |
Destructor. | |
void | reset () |
This method resets the timer. | |
void | start () |
This method starts the timer. | |
void | stop () |
This method is used to stop/pause the timer. | |
void | advance () |
This method is used to incrementally advance the timer by 0.1 seconds. | |
float | getAbsoluteTime () |
This method returns the absolute system time. | |
float | getTime () |
This method returns the current time. | |
float | getElapsedTime () |
This method returns the time that has elapsed between getElapsedTime. | |
bool | isStopped () |
This method just returns if our timer is active or not. | |
Protected Attributes | |
bool | m_bUsingQPF |
are we using the high performance timer? | |
bool | m_bTimerStopped |
is the timer stopped? | |
LONGLONG | m_llQPFTicksPerSec |
LONGLONG for ticks/sec. | |
LONGLONG | m_llStopTime |
LONGLONG | m_llLastElapsedTime |
LONGLONG | m_llBaseTime |
Every frame of the game, we update this object with a snapshot of the current clock of the CPU in order to create a delta (differential) with the last clock snapshot. This delta controls the movement of the objects in our gameworld.
To make this object more platform independent, feel free to investigate using the SDL timer functions
Note that on some newer multi-processor systems, the QPC doesn't always cut the mustard. Depending upon your app, the resolution of timeGetTime() might be enough for your object animation...
It really just takes some experimentation folks..
|
This method returns the absolute system time.
|
|
This method returns the time that has elapsed between getElapsedTime.
|
|
This method returns the current time.
|
|
This method just returns if our timer is active or not.
|