Mail Archives: djgpp/1999/10/08/20:48:25
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> That might be because of the rest(1000) call. How much time does it
> wait? (I don't know much about ALlegro.) If it waits enough time, the
> keyboard buffer could become full.
void delay(int t);
delay() is a function (in the standard C library IIRC) that programs
the internal timer to wait t milliseconds. On the PC, that comes
out to 1193n PC ticks. Back in the days before Allegro, when
programming the Sound Blaster was too much of a pain in the ***
to be attempted by anyone but professionals, many games used
the PC speaker and used delay() to set the length of a note. In
fact, the Borland C++ library reference actually listed sound() and
delay() together.
void rest(int t);
rest() is the same as delay() except it uses Allegro's timer interface
instead of programming your system's timer directly. rest(n) also
waits t milliseconds.
Which should I use?
It depends on if you've called install_timer() or not. Under Windows,
install_timer() reprograms the timer to generate an interrupt
every five milliseconds, i.e., 200 Hz. This timer programming
is incompatible with delay(), which expects the timer to still be
programmed at 18.2 Hz. That's why Shawn and the gang added
the rest() function.
(No, i.e. does not stand for the web browser Infernal Exploder.)
Damian Yerrick
http://come.to/yerrick
- Raw text -