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

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. | |
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.
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.
| timeLimit | The initial time limit (must be greater than zero). |
| initiallyRunning | Indicates whether the timer is immediately being started. |
| 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.
| timeLimit | The new time limit (must be greater than zero). |
| restart | True when the timer continues to run, false if it waits for the next Start() call. |
Reimplemented in thor::TriggeringTimer.
| 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.