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

Pausable clock class that measures elapsed time. More...

Public Member Functions

 StopWatch ()
 Constructor: Sets up a paused stopwatch with time zero. More...
 
sf::Time getElapsedTime () const
 Returns the totally elapsed time.
 
bool isRunning () const
 Checks if the stopwatch is currently running.
 
void start ()
 Starts or continues the stopwatch. More...
 
void stop ()
 Pauses the stopwatch. More...
 
void reset ()
 Resets the stopwatch's elapsed time to zero and stops it. More...
 
void restart ()
 Resets the stopwatch's elapsed time to zero and starts it again. More...
 

Detailed Description

Pausable clock class that measures elapsed time.

Unlike sf::Clock, this clock can be paused and continued at any time.

Constructor & Destructor Documentation

thor::StopWatch::StopWatch ( )

Constructor: Sets up a paused stopwatch with time zero.

The stopwatch is initially not running. Call start() to run it.

Member Function Documentation

void thor::StopWatch::reset ( )

Resets the stopwatch's elapsed time to zero and stops it.

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

void thor::StopWatch::restart ( )

Resets the stopwatch's elapsed time to zero and starts it again.

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

void thor::StopWatch::start ( )

Starts or continues the stopwatch.

If it is already running, nothing happens.

void thor::StopWatch::stop ( )

Pauses the stopwatch.

If it is already paused, nothing happens.


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