List of all members | Public Member Functions
thor::Timer Class Reference

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

Inheritance diagram for thor::Timer:
Inheritance graph

Public Member Functions

 Timer ()
 Default constructor: Creates a timer that is initially expired. More...
 
virtual ~Timer ()
 Virtual destructor.
 
sf::Time getRemainingTime () const
 Returns the remaining time. More...
 
bool isRunning () const
 Checks if the timer is currently running. More...
 
bool isExpired () const
 Checks if the timer has expired yet. More...
 
void start ()
 Starts or continues the timer. More...
 
void stop ()
 Pauses the timer. More...
 
virtual void reset (sf::Time timeLimit)
 Resets the timer's remaining time to the given limit and stops it. More...
 
virtual void restart (sf::Time timeLimit)
 Resets the timer's remaining time to the given limit and starts it again. More...
 

Detailed Description

Clock class that has the semantics of a countdown timer.

After starting the timer, it will automatically count down, until the remaining time reaches zero.

Constructor & Destructor Documentation

thor::Timer::Timer ( )

Default constructor: Creates a timer that is initially expired.

You have to call reset() or restart() before you can use the countdown functionality.

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.

virtual void thor::Timer::reset ( sf::Time  timeLimit)
virtual

Resets the timer's remaining time to the given limit and stops it.

Parameters
timeLimitThe new time limit (must be greater than zero).

In contrast to restart(), the timer is not running after the call.

Reimplemented in thor::CallbackTimer.

virtual void thor::Timer::restart ( sf::Time  timeLimit)
virtual

Resets the timer's remaining time to the given limit and starts it again.

Parameters
timeLimitThe new time limit (must be greater than zero).

The behavior is equivalent to reset(timeLimit) followed by start().

Reimplemented in thor::CallbackTimer.

void thor::Timer::start ( )

Starts or continues the timer.

If it is already running, nothing happens.

void thor::Timer::stop ( )

Pauses the timer.

If it is already paused, nothing happens.


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