CoarseTimer

Implements a coarse timer, that checks the time periodically (e.g. on VSYNC), then calls the delegate if the time assigned to it has been lapsed. Is fast and can effectively test for multiple elements, but is inaccurate which can even fluctuate if tests are done on VSYNC intervals. This will make the duration longer in every case (up to 16.7ms on 60Hz displays), but this still should be accurate enough for many cases. Delegates must take no arguments and nothrow to avoid issues from that.

Constructors

this
this()

CTOR

Members

Aliases

TimerReceiver
alias TimerReceiver = void delegate()
Undocumented in source.

Functions

register
void register(TimerReceiver dg, Duration delta)

Registers an entry for the timer. Delta sets the amount of time into the future.

test
void test()

Tests the entries. If enough time has passed, then those entries will be called and deleted.

Structs

Entry
struct Entry

A timer entry.

Variables

status
uint status;

1 if during testing, 0 otherwise

timerList
SortedList!Entry timerList;

The list of timer entries.

timerRegs
Entry[] timerRegs;

Secondary timer list

Meta