Defined in File sixtyfps.h
A Timer that can call a callback at repeated interval
Use the static single_shot function to make a single shot timer
Construct a null timer. Use the start() method to activate the timer with a mode, interval and callback.
inline Timer(std::chrono::milliseconds interval, F callback)
Construct a timer which will repeat the callback every
intervalmilliseconds until the destructor of the timer is called.
This is a convenience function and equivalent to calling
start(sixtyfps::TimerMode::Repeated, interval, callback);on a default constructed Timer.
inline void start(TimerMode mode, std::chrono::milliseconds interval, F callback)
Starts the timer with the given mode and interval, in order for the callback to called when the timer fires. If the timer has been started previously and not fired yet, then it will be restarted.
inline void stop()
inline void restart()
Restarts the timer. If the timer was previously started by calling [
Self::start()] with a duration and callback, then the time when the callback will be next invoked is re-calculated to be in the specified duration relative to when this function is called.
Does nothing if the timer was never started.
inline bool running() const
Returns true if the timer is running; false otherwise.
- inline Timer()