Bromeon
Public Member Functions
thor::Timer Class Reference

Clock class that has the semantics of a timer. More...

Inheritance diagram for thor::Timer:
Inheritance graph

List of all members.

Public Member Functions

 Timer ()
 Default constructor: Creates a timer that is initially expired.
virtual ~Timer ()
 Virtual destructor.
 Timer (float timeLimit, bool initiallyRunning=false)
 Constructor: Sets up a new timer with the given time limit.
float GetRemainingTime () const
 Returns the remaining time.
bool IsRunning () const
 Checks if the timer is currently running.
bool IsExpired () const
 Checks if the timer has expired yet.
void Start ()
 Starts or continues the timer.
void Stop ()
 Pauses the timer.
virtual void Reset (float timeLimit, bool continueRunning=false)
 Resets the timer's countdown to the given time limit.

Detailed Description

Clock class that has the semantics of a timer.

You can initialize an instance with a time limit and it will automatically count down, until the time reaches zero.


Constructor & Destructor Documentation

Default constructor: Creates a timer that is initially expired.

You have to call Reset() before you can use the countdown functionality.

thor::Timer::Timer ( float  timeLimit,
bool  initiallyRunning = false 
) [explicit]

Constructor: Sets up a new timer with the given time limit.

Parameters:
timeLimitThe initial time (must be greater than zero).
initiallyRunningIndicates whether the timer is immediately being started.

Member Function Documentation

Returns the remaining time.

If the timer has expired, 0.f is returned.

bool thor::Timer::IsExpired ( ) const

Checks if the timer has expired yet.

Timers expire when their remaining time reaches zero.

bool thor::Timer::IsRunning ( ) const

Checks if the timer is currently running.

As soon as the timer expires, it stops running until Reset() is called.

virtual void thor::Timer::Reset ( float  timeLimit,
bool  continueRunning = false 
) [virtual]

Resets the timer's countdown to the given time limit.

Parameters:
timeLimitThe new time (must be greater than zero).
continueRunningIndicates whether the timer directly continues.

Reimplemented in thor::TriggeringTimer.

Starts or continues the timer.

If it is already running, nothing happens.

Pauses the timer.

If it is already paused, nothing happens.


The documentation for this class was generated from the following file: