Class DTimer



DTimer periodically calls an event handler at a set interval. See the Event Handling section for details. The timer's resolution depends on how often DEngine::update is called, up to a maximum accuracy of 1 millisecond.

Functions


DTimer(DEngine *newEngine)

The default constructor accepts a DEngine that will handle our events.


DTimer(const DTimer &source)

Creates a DTimer that is a copy of source.


DTimer& operator= (const DTimer &source)

Sets this DTimer to be a copy of source.


unsigned int getInterval(void)

Returns the interval at which the event handler will be called, in milliseconds.


bool isRunning(void)

Returns true if this timer is currently running, false otherwise.


void setInterval(unsigned int interval)

Sets the interval at which the event handler will be called, in milliseconds.


void setHandler(boost::function<void (void)> handler)

Specify a handler to call when the timer elapses.


void start(void)

Start the timer. The event handler will be called at the specified interval. If the timer is currently running, it resets the timer so that interval milliseconds will pass before the handler is called.


void stop(void)

Stop the timer.





















Back to class reference