Mail Archives: djgpp/1999/05/04/06:10:31
Unigni writes:
> I was wondering how to get a timer in milliseconds, so that
> each game loop would take 100 milliseconds -- NOT doing
> stuff and *then* waiting 100 milliseconds.
Several people have already commented that you can use uclock()
for this, but if you are using Allegro, that isn't such a great
plan since Allegro will probably already be using its own
timer module (that is needed for things like mouse input and
MIDI playback, and can conflict with the libc time functions).
Using Allegro, you can either check the global retrace_count
variable, or install a timer callback function of your own.
The ex7 example program shows how to do this, and for examples
of using them to control game speed, look at the demo game
and the Allegro FAQ.
Shawn Hargreaves.
- Raw text -