Defined in:A deferred task which signals the expiration of a specific amount of time.
class Timer : public DeferredTask
||Returns the length of time until the timer is triggered.|
||Sets the length of time which should pass before the timer is triggered.|
Timer(int32 time, CompletionCallback *callback, void *cookie = nullptr);
||The length of time, in milliseconds, which should pass before the timer is triggered.|
||The callback to invoke when the task is triggered.|
||The cookie that is passed to the trigger callback as its last parameter.|
Timerclass encapsulates a deferred task which is triggered after the time specified by the
timeparameter. Once a timer is registered using the
TimeMgr::AddTaskfunction, its remaining time is reduced each frame until it reaches zero, at which point its callback function is invoked. The callback function specified by the
callbackparameter should have the following prototype.
When the timer is triggered, the callback is invoked with the pointer specified by the
typedef void CompletionCallback(DeferredTask *, void *);
cookieparameter passed to it as its second argument. A timer is triggered only once and must be resubmitted with the
TimeMgr::AddTaskfunction in order to be triggered again.