Class for handling smooth interpolation of events. A callback can be registered with a given id and time. The callback will be called with the given delta time until the time is depleted.
More...
#include <TimerCallbackSystem.hpp>
|
| void | elapseTime (float dt) |
| | Elapses time by the given delta time, meaning calling the callbacks with the given delta time. More...
|
| |
| void | addTimerCallback (int id, float time, std::function< void(float dt)> callback, float factor=1.f) |
| | Adds a new timer callback for the given id. More...
|
| |
| bool | forceQuitCallback (int id) |
| | Immediately forces the removal of the callback with the given id, without finishing the remaining time. More...
|
| |
| bool | finishCallback (int id) |
| | Forces the callback to be completed with the time left in the timer and removes it from the system. More...
|
| |
Class for handling smooth interpolation of events. A callback can be registered with a given id and time. The callback will be called with the given delta time until the time is depleted.
◆ addTimerCallback()
| void TimerCallbackSystem::addTimerCallback |
( |
int |
id, |
|
|
float |
time, |
|
|
std::function< void(float dt)> |
callback, |
|
|
float |
factor = 1.f |
|
) |
| |
Adds a new timer callback for the given id.
- Parameters
-
| id | is the identification for the given callback |
| time | is the time it takes to finish the action set to the callback in seconds |
| callback | is the function that can be called with given delta time |
◆ elapseTime()
| void TimerCallbackSystem::elapseTime |
( |
float |
dt | ) |
|
Elapses time by the given delta time, meaning calling the callbacks with the given delta time.
- Parameters
-
| dt | is the delta time to elapse in seconds. |
◆ finishCallback()
| bool TimerCallbackSystem::finishCallback |
( |
int |
id | ) |
|
Forces the callback to be completed with the time left in the timer and removes it from the system.
- Parameters
-
| id | of the object to be finished |
- Returns
- true if the callback was found and finished, false if the callback was not found
◆ forceQuitCallback()
| bool TimerCallbackSystem::forceQuitCallback |
( |
int |
id | ) |
|
Immediately forces the removal of the callback with the given id, without finishing the remaining time.
- Parameters
-
- Returns
- true if the callback was removed, false, if the given id was not found
◆ mutexM
| std::mutex TimerCallbackSystem::mutexM |
|
private |
◆ timersM
The documentation for this class was generated from the following files: