Mail Archives: djgpp/1997/09/10/10:53:26
On Tue, 9 Sep 1997, J.E. wrote:
> 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.
>
You can just use what I mostly use. I your loop place a statment like
that:
int ch;
while (...) {
.
.
if (keypressed()) {
ch = readkey();
/* and in here process the key press */
} /* end of if statment */
.
.
} /* end of while loop */
>
,,,
(0 0)
+-------------oOO----(_)-------------------+
| Andrew Deren |
| aderen AT eecs DOT uic DOT edu |
| www.eecs.uic.edu/~aderen/ader/main.html |
+-------------------------oOO--------------+
|| ||
ooO Ooo
- Raw text -