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... | |
Pausable clock class that measures elapsed time.
Unlike sf::Clock, this clock can be paused and continued at any time.
thor::StopWatch::StopWatch | ( | ) |
Constructor: Sets up a paused stopwatch with time zero.
The stopwatch is initially not running. Call start() to run it.
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 | ( | ) |
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.