36 void addTimerCallback(
int id,
float time, std::function<
void(
float dt)> callback,
float factor = 1.f);
constexpr float EPSILON
Definition: TimerCallbackSystem.hpp:6
Class for handling smooth interpolation of events. A callback can be registered with a given id and t...
Definition: TimerCallbackSystem.hpp:22
std::mutex mutexM
Definition: TimerCallbackSystem.hpp:58
void elapseTime(float dt)
Elapses time by the given delta time, meaning calling the callbacks with the given delta time.
Definition: TimerCallbackSystem.cpp:3
bool forceQuitCallback(int id)
Immediately forces the removal of the callback with the given id, without finishing the remaining tim...
Definition: TimerCallbackSystem.cpp:31
std::map< int, CallBackTimer > timersM
Definition: TimerCallbackSystem.hpp:59
bool finishCallback(int id)
Forces the callback to be completed with the time left in the timer and removes it from the system.
Definition: TimerCallbackSystem.cpp:38
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.
Definition: TimerCallbackSystem.cpp:25
Struct representing a callback with a timer. Timer is decremented with the given deltatime.
Definition: TimerCallbackSystem.hpp:12
std::function< void(float dt)> callback
Definition: TimerCallbackSystem.hpp:15
float time
Definition: TimerCallbackSystem.hpp:13
float factor
Definition: TimerCallbackSystem.hpp:14