Mail Archives: djgpp/1997/09/10/15:22:53
J.E. writes:
>I am writing a game with Allegro, but I'm having some problems. I want
>there to be a loop that checks, each time through the loop, for a key
>press, and continues if there is none. I tried using kbhit() to check
>the key buffer, but it would still just sit there waiting with getch().
>I am assuming that kbhit() is working fine, but I need an alternative to
>getch(). I need a function, similar to getch(), that reads a key from
>the buffer WITHOUT pausing.
Have you called the Allegro install_keyboard() function? If so the
kbkit() and getch() functions will no longer work, because the BIOS
doesn't see any keyboard input after Allegro takes it over (this is
explained in allegro.txt). If you are indeed using the Allegro code, you
can either call keypressed() to test if there is a key waiting for the
readkey() function to access, or check the values in the key[] array to
detect the state of a specific key. See examples/ex5.c...
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -