delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/10/10:53:26

Date: Wed, 10 Sep 1997 09:54:38 -0500 (CDT)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: "J.E." <cellis AT voyageur DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: Key Detection in Allegro
In-Reply-To: <3416103D.4537@voyageur.ca>
Message-ID: <Pine.SUN.3.95.970910095257.372A-100000@s5i.eecs.uic.edu>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019