Timer Class Reference

Simple message-based timer class. More...

#include <VSTGLTimer.h>

Inheritance diagram for Timer:

ExampleEditor List of all members.

Public Member Functions

 Timer (int interval)
 Constructor.
virtual ~Timer ()
 Destructor.
bool start ()
 Call this to start the timer running.
void stop ()
 Call this to stop the timer running.
bool isRunning () const
 Returns whether or not the timer is currently running.
virtual void timerCallback ()=0
 Called at every interval.

Static Public Member Functions

static void __stdcall timerProc (HWND hWnd, unsigned int uMsg, unsigned int idEvent, unsigned long dwTime)
 Windows: Windows callback function, calls timerCallback().

Private Attributes

int timerId
 Windows: Timer ID, used to kill the timer in the stop() method.
int timerInterval
 The interval the timer is running at.
bool running
 Whether or not the timer is currently running.

Detailed Description

Simple message-based timer class.

By Timer, I mean it repeatedly calls timerCallback(), every interval milliseconds.

Note that this relies on the operating system's simple message-based timers, and therefore is not going to be absolutely accurate - generally a 10msec interval is the best you can hope for, and it may fluctuate if the event queue is particularly busy.


Constructor & Destructor Documentation

Timer::Timer int  interval  ) 
 

Constructor.

Parameters:
interval The time (in milliseconds) between calls to timerCallback. Generally 10 msecs is the shortest interval that is realistically possible.

Timer::~Timer  )  [virtual]
 

Destructor.

Will call stop() if the timer is still running.


Member Function Documentation

bool Timer::start  ) 
 

Call this to start the timer running.

Returns:
True if it was successful, false otherwise.

virtual void Timer::timerCallback  )  [pure virtual]
 

Called at every interval.

Override this with the code you want called periodically.

Implemented in ExampleEditor.


The documentation for this class was generated from the following files:
Generated on Mon Aug 7 19:03:50 2006 for VSTGL by  doxygen 1.4.5