![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Timer used to run code in fixed intervals. More...
#include <Timer.h>
Public Member Functions | |
| Timer (Uint32 interval, bool frameSkipping=false) | |
| Creates a stopped timer. More... | |
| ~Timer () | |
| Cleans up the timer. | |
| void | start () |
| Starts the timer. More... | |
| void | stop () |
| Stops the timer. More... | |
| Uint32 | getTime () const |
| Gets the current time interval. More... | |
| bool | isRunning () const |
| Gets if the timer's running. More... | |
| void | think (State *state, Surface *surface) |
| Advances the timer. More... | |
| void | setInterval (Uint32 interval) |
| Sets the timer's interval. More... | |
| void | onTimer (StateHandler handler) |
| Hooks a state action handler to the timer interval. More... | |
| void | onTimer (SurfaceHandler handler) |
| Hooks a surface action handler to the timer interval. More... | |
| void | setFrameSkipping (bool skip) |
| Turns frame skipping on or off. More... | |
Timer used to run code in fixed intervals.
Used for code that should run at the same fixed interval in various machines, based on miliseconds instead of CPU cycles.
| OpenXcom::Timer::Timer | ( | Uint32 | interval, |
| bool | frameSkipping = false |
||
| ) |
Creates a stopped timer.
Initializes a new timer with a set interval.
| interval | Time interval in milliseconds. |
| frameSkipping | Use frameskipping. |
| Uint32 OpenXcom::Timer::getTime | ( | ) | const |
Gets the current time interval.
Returns the time passed since the last interval.
| bool OpenXcom::Timer::isRunning | ( | ) | const |
Gets if the timer's running.
Returns if the timer has been started.
| void OpenXcom::Timer::onTimer | ( | StateHandler | handler | ) |
Hooks a state action handler to the timer interval.
Sets a state function for the timer to call every interval.
| handler | Event handler. |
| void OpenXcom::Timer::onTimer | ( | SurfaceHandler | handler | ) |
Hooks a surface action handler to the timer interval.
Sets a surface function for the timer to call every interval.
| handler | Event handler. |
| void OpenXcom::Timer::setFrameSkipping | ( | bool | skip | ) |
Turns frame skipping on or off.
Sets frame skipping on or off.
| skip | Enable frameskipping. |
| void OpenXcom::Timer::setInterval | ( | Uint32 | interval | ) |
Sets the timer's interval.
Changes the timer's interval to a new value.
| interval | Interval in milliseconds. |
| void OpenXcom::Timer::start | ( | ) |
Starts the timer.
Starts the timer running and counting time.
| void OpenXcom::Timer::stop | ( | ) |
Stops the timer.
Stops the timer from running.
1.8.14