The timer system.
The timer system. The timer class is not really a proper class. It is just a bunch of static functions which provide basic timer functionality at a level just slightly above the level of the underlaying Allegro timer functions. It can install up to 8 separate timers (more than anyone should ever need), it has wrapper functions for the Allegro timer functions and a nice little function for checking when a timer has ticked.
Typically the above three functions are used together in the main loop like this:
int timerID = -1;
while (!done) {
while (timerID = Timer::Check()) {
switch (timerID) {
case 0: suppose 0 is the ID of the main logic timer
DoLogic();
break;
case 1: supopse 1 is the ID of the timer used to measure FPS
MeasureFPS();
break;
case 2:
...
...
}
Timer::Update(timerID);
}
Timer::ResetFrameSkip();
Render();
}
The dialog manager does roughly something like this so unless you're not using
the dialog manager, you don't really need to know about this.
Alphabetic index Hierarchy of classes