delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/30/00:02:06

From: MadPete AT Mad DOT Pete (Mad Pete)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Checking and retrieving keypresses in Allegro
Date: Sat, 30 Aug 1997 02:13:00 GMT
Organization: Barrie Connex Inc.
Lines: 24
Message-ID: <34078157.18332959@news.bconnex.net>
References: <5u79gn$m3k$1 AT news DOT interlog DOT com>
NNTP-Posting-Host: pm9-34.barrie.connex.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 29 Aug 97 20:00:20 GMT, gautam AT interlog DOT com (Gautam N. Lad) wrote:

>So, now, how can I find out if a key is being pressed, just anywhere.
>Whenever a key is pressed, I want to find out what that key is.
>
>I've looked into Allegro's GUI.C source, in the d_edit_proc section (and just 
>about everywhere else), but I'm confused as to how it retrieves key presses.  
>Does it have anything to do with MSG_CHAR?  Allegro's keyboard handler is 
>interrupt based, so it is constantlly recieving keypresses, right?  How can I 
>retrieve these keys?

Allegro (and pretty much any DOS game) installs their own keyboard driver so
that whenever a key is pressed or released, it calls the keyboard interrupt.
Allegro included a small piece of code in the interrupt to toggle the key flags.

So all you have to do is check if the flag is turned on or off for a key.  The
code in the interrupt does the rest.

---------------------------------------------------------------------
Pete Thompson (aka Mad Pete)
Formerly from Digipen Applied Computer Graphics Inc.  (Gaming School)
For more information on Digipen:  www.digipen.com
Contact me at:  ruinan AT ncmud DOT accessv DOT com
---------------------------------------------------------------------

- Raw text -


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