From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Key Detection in Allegro Date: Wed, 10 Sep 1997 18:53:57 +0100 Organization: None Distribution: world Message-ID: References: <3416103D DOT 4537 AT voyageur DOT ca> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 21 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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.