Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Moteur3D::Timer Class Reference

The Timer class is the base class that will allow you to implement your own timers. It works in an easy way : set the delay (in milliseconds) with SetDelay(), call Start(), and when the time is elapsed, the OnTick() event will be triggered. The resolution of this timer is about 15-20 milliseconds, and depends on the framerate : at 60fps, the resolution is about 16ms. It should be more than enough for most applications. More...

#include <Timer.h>

List of all members.

Public Member Functions

 Timer ()
 Constructor.
 ~Timer ()
 Destructor.
void Start ()
 Starts the timer. A delay must have been set.
int GetDelay ()
 Returns the delay the timer will set when you call Start(). Note that it is NOT the remaining delay if you've already called Start().
void SetDelay (int ms)
 Sets the delay before OnTick() is triggered after Start() is called.

Protected Member Functions

virtual void OnTick ()=0
 Function triggered when the timer has been started and its delay expired.

Protected Attributes

int m_Delay
 Delay before OnTick() is triggered after Start() is called.

Friends

class MasterTimer


Detailed Description

The Timer class is the base class that will allow you to implement your own timers. It works in an easy way : set the delay (in milliseconds) with SetDelay(), call Start(), and when the time is elapsed, the OnTick() event will be triggered. The resolution of this timer is about 15-20 milliseconds, and depends on the framerate : at 60fps, the resolution is about 16ms. It should be more than enough for most applications.

Note that these timers are not suitable for every kind of timed operations; as an example, if you want do display a character that walks all the time, you would better check at each render what's the current time and extrapolate its position, rather than calling a timer with 1ms that will tick all the time.


Constructor & Destructor Documentation

Moteur3D::Timer::Timer  ) 
 

Constructor.

Moteur3D::Timer::~Timer  ) 
 

Destructor.


Member Function Documentation

int Moteur3D::Timer::GetDelay  ) 
 

Returns the delay the timer will set when you call Start(). Note that it is NOT the remaining delay if you've already called Start().

virtual void Moteur3D::Timer::OnTick  )  [protected, pure virtual]
 

Function triggered when the timer has been started and its delay expired.

void Moteur3D::Timer::SetDelay int  ms  ) 
 

Sets the delay before OnTick() is triggered after Start() is called.

void Moteur3D::Timer::Start  ) 
 

Starts the timer. A delay must have been set.


Friends And Related Function Documentation

friend class MasterTimer [friend]
 


Member Data Documentation

int Moteur3D::Timer::m_Delay [protected]
 

Delay before OnTick() is triggered after Start() is called.


The documentation for this class was generated from the following file:
Generated on Sat Oct 15 15:05:52 2005 for Moteur3D by  doxygen 1.4.4