delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/30/06:49:07

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Keys
Date: 29 Jul 1997 23:36:18 GMT
Organization: Oxford University, England
Lines: 19
Message-ID: <5rlupi$101@news.ox.ac.uk>
References: <Pine DOT LNX DOT 3 DOT 91 DOT 970729164417 DOT 19687A-100000 AT tabor DOT ta DOT jcu DOT cz>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jan Hubicka (hubicka AT ta DOT jcu DOT cz) wrote:
: Hi. I need to know ascii codes of pressed keys. But I also need to be 
: informed about ther release. Whats the easiest way to do this?

The easiest way is to use Allegro, which already does the ground work for
you. Technically speaking, you need to intercept the keyboard IRQ,
processing it suitably to discover whether the message is a press or a
release. Then you update an array showing the keys' states, or put a
message in a queue, or something similarly useful. The main program will
read this array or event queue later on.

Allegro's routines provide such an array, indexed by scancode, and
#defines for each key on the keyboard to give the scancodes. You can
extract the keyboard code from Allegro, of course, and use it seperately
from the rest of the library.

-- 
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford

- Raw text -


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