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 (sf::Time timeLimit, bool initiallyRunning=false)
 Constructor: Sets up a new timer with the given time limit.
sf::Time 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 (sf::Time timeLimit, bool restart=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 ( sf::Time  timeLimit,
bool  initiallyRunning = false 
) [explicit]

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

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

Member Function Documentation

sf::Time thor::Timer::GetRemainingTime ( ) const

Returns the remaining time.

If the timer has expired, sf::Time::Zero 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 ( sf::Time  timeLimit,
bool  restart = false 
) [virtual]

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

Parameters:
timeLimitThe new time limit (must be greater than zero).
restartTrue when the timer continues to run, false if it waits for the next Start() call.

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: