PropaneTimer Class Reference

Basic one-way timer for game events. More...

#include <PropaneTimers.h>

Inheritance diagram for PropaneTimer:

PropaneAutoResetTimer List of all members.

Public Member Functions

float getTime ()
 Return the current time used.
virtual bool update (float delta)
 Update the timer; delta is in seconds. Returns TRUE if this update tripped the timer.
void reset ()
 Reset the timer and start over.
void setLimit (float lim)
 Set the limit where the timer will trip.
float percentComplete ()
 Check the percent completed of this timer.
void setIncrements (bool incr)
 Set whether or not the timer increments or decrements.
 PropaneTimer (float limit, bool increment)
 Construct with a limit and the option to increment.
 PropaneTimer ()
 Construct with nothing.
virtual ~PropaneTimer ()
 Destruct.

Protected Attributes

float timer
 The current time.
float limit
 The limit (when decrementing, resetting will set this to it, otherwise it will set to 0 and count up to this limit).
bool increments
 Toggle if it's incrementing or decrementing.

Detailed Description

Basic one-way timer for game events.


Constructor & Destructor Documentation

PropaneTimer::PropaneTimer float  mLimit,
bool  mIncr
 

Construct with a limit and the option to increment.

Variable constructor.

Parameters:
mLimit The time span between each timer fire, in seconds
mIncr If true, the timer will increment. Otherwise, decrement.

PropaneTimer::PropaneTimer  ) 
 

Construct with nothing.

Default constructor, sets 100ms decrementing timer.

PropaneTimer::~PropaneTimer  )  [virtual]
 

Destruct.

Basic destructor. Does nothing.


Member Function Documentation

float PropaneTimer::getTime  ) 
 

Return the current time used.

Gets the current time elapsed since the last timer fire, in seconds.

Returns:
The time elapsed since last timer fire, in seconds.

float PropaneTimer::percentComplete  ) 
 

Check the percent completed of this timer.

Gets the time elapsed since last timer fire, in percentages.

Returns:
The time elapsed since last timer fire, in a percentage from 0 to 100 inclusive.

void PropaneTimer::reset  ) 
 

Reset the timer and start over.

Resets the time elapsed to 0

void PropaneTimer::setLimit float  lim  ) 
 

Set the limit where the timer will trip.

Allows you to set the time span between each timer fire.

Parameters:
lim The time span between each timer fire, in seconds.

bool PropaneTimer::update float  delta  )  [virtual]
 

Update the timer; delta is in seconds. Returns TRUE if this update tripped the timer.

Updates the time span with a given number of seconds. After firing, you must manually reset this timer, or it will continue to return true on successive uses of this method.

Parameters:
delta The number of seconds that have passed.
Returns:
True if the timer fires after this update, false otherwise.

Reimplemented in PropaneAutoResetTimer.


The documentation for this class was generated from the following files:
Generated on Sun Jan 14 16:49:11 2007 for Propane Injector by  doxygen 1.4.6