Date: Wed, 10 Sep 1997 09:54:38 -0500 (CDT) From: Andrew Deren To: "J.E." cc: djgpp AT delorie DOT com Subject: Re: Key Detection in Allegro In-Reply-To: <3416103D.4537@voyageur.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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