random_utils::TimeableObject Class Reference

A object which uses GLUT timers to call itself back after a given amount of time. More...

#include <TimeableObject.h>

Inheritance diagram for random_utils::TimeableObject:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TimeableObject ()
 Ctor.
virtual ~TimeableObject ()
 Dtor.

Protected Member Functions

void startTimer (unsigned int milliseconds)
 Starts a new timer which will probably call timerTick() in milliseconds milliseconds.
void stopTimer ()
 Stops the timer, there will be no callback next time.
void changeTimer (unsigned int milliseconds)
 Changes the timer interval to milliseconds milliseconds.
virtual void timerTick ()=0
 You have to implement this pure-virtual method if you derive from TimeableObject so you can recieve timer events.

Private Types

enum  { INITIALIZED, RUNNING, SHUTDOWN }
 Holds the current state of the object. More...

Private Member Functions

void internalTimerTick ()
 This method wrapps timerTick(), and does the other internal stuff to setup the timers, etc.
void restartTimer ()
 Also used internally to start the timer again.

Static Private Member Functions

static void wrapperFunction (int self)
 This is the function we register at GLUT which then calls internalTimerTick().

Private Attributes

unsigned int m_currentDelay
 The current timer delay, used in restartTimer().
enum random_utils::TimeableObject:: { ... }  m_state
 Holds the current state of the object.

Detailed Description

A object which uses GLUT timers to call itself back after a given amount of time.

Definition at line 11 of file TimeableObject.h.


Member Enumeration Documentation

anonymous enum [private]

Holds the current state of the object.

Enumerator:
INITIALIZED 
RUNNING 
SHUTDOWN 

Definition at line 21 of file TimeableObject.h.


Constructor & Destructor Documentation

random_utils::TimeableObject::TimeableObject (  ) 

Ctor.

Definition at line 13 of file TimeableObject.cpp.

References INITIALIZED, and m_state.

random_utils::TimeableObject::~TimeableObject (  )  [virtual]

Dtor.

Definition at line 18 of file TimeableObject.cpp.

References m_state, and SHUTDOWN.


Member Function Documentation

void random_utils::TimeableObject::wrapperFunction ( int  self  )  [static, private]

This is the function we register at GLUT which then calls internalTimerTick().

Definition at line 24 of file TimeableObject.cpp.

Referenced by restartTimer().

Here is the caller graph for this function:

void random_utils::TimeableObject::internalTimerTick (  )  [private]

This method wrapps timerTick(), and does the other internal stuff to setup the timers, etc.

Definition at line 30 of file TimeableObject.cpp.

References INITIALIZED, m_state, restartTimer(), RUNNING, SHUTDOWN, and timerTick().

Here is the call graph for this function:

void random_utils::TimeableObject::restartTimer (  )  [private]

Also used internally to start the timer again.

Definition at line 81 of file TimeableObject.cpp.

References m_currentDelay, and wrapperFunction().

Referenced by internalTimerTick(), and startTimer().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_utils::TimeableObject::startTimer ( unsigned int  milliseconds  )  [protected]

Starts a new timer which will probably call timerTick() in milliseconds milliseconds.

Definition at line 48 of file TimeableObject.cpp.

References m_currentDelay, m_state, restartTimer(), RUNNING, and SHUTDOWN.

Referenced by random_racer::ThirdPersonCameraHelper::setDelay(), random_racer::CenterScreenDisplay::showText(), random_racer::Presenter::startAnimation(), random_racer::Console::startAnimation(), and random_racer::CenterScreenDisplay::timerTick().

Here is the call graph for this function:

Here is the caller graph for this function:

void random_utils::TimeableObject::stopTimer (  )  [protected]

Stops the timer, there will be no callback next time.

Definition at line 68 of file TimeableObject.cpp.

References m_state, RUNNING, and SHUTDOWN.

Referenced by random_racer::Presenter::timerTick(), random_racer::Console::timerTick(), and random_racer::CenterScreenDisplay::timerTick().

Here is the caller graph for this function:

void random_utils::TimeableObject::changeTimer ( unsigned int  milliseconds  )  [protected]

Changes the timer interval to milliseconds milliseconds.

Definition at line 75 of file TimeableObject.cpp.

References m_currentDelay.

virtual void random_utils::TimeableObject::timerTick (  )  [protected, pure virtual]

You have to implement this pure-virtual method if you derive from TimeableObject so you can recieve timer events.

Implemented in random_racer::CenterScreenDisplay, random_racer::Console, random_racer::Presenter, and random_racer::ThirdPersonCameraHelper.

Referenced by internalTimerTick().

Here is the caller graph for this function:


Member Data Documentation

unsigned int random_utils::TimeableObject::m_currentDelay [private]

The current timer delay, used in restartTimer().

Definition at line 16 of file TimeableObject.h.

Referenced by changeTimer(), restartTimer(), and startTimer().

enum { ... } random_utils::TimeableObject::m_state [private]

Holds the current state of the object.

Referenced by internalTimerTick(), startTimer(), stopTimer(), TimeableObject(), and ~TimeableObject().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:16 2007 for Random Racer by  doxygen 1.5.1