cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/13/08:31:50

From: gah AT jet DOT es (Grzegorz Adam Hankiewicz)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Obtaining Alt/Control/Shift keypresses? (DJGPP/Allegro)
Date: Sun, 13 Sep 1998 12:21:35 GMT
Organization: Gogosoftware
Lines: 20
Message-ID: <35fbb79b.7155404@news.jet.es>
References: <35F67B75 DOT FA53A299 AT pobox DOT com>
NNTP-Posting-Host: info54.jet.es
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Wed, 09 Sep 1998 14:58:29 +0200, Satyr <satyr AT pobox DOT com> wrote:
>I'm looking for a way to detect the keypresses on the shift/alt/control
>keys (i.e. the modifier keys) at the time they're hit as well as when
>they're released. What is the recommended way to do this with DJGPP and
>Allegro, other than writing an interrupt handler?

You can detect those keys just as normal keys using Allegro. The
values of shift/alt/control keys are stored in a bitfield named
key_shifts, which you can always check once you have installed
Allegro's keyboard handler.
You may read Allegro's documentation section "Keyboard routines" for
more info on this.

Quick example:

if ( key_shifts & KB_ALT_FLAG)
	printf("You are pressing the alt key");

- Grzegorz Adam Hankiewicz - gah AT jet DOT es - http://web.jet.es/gregorio/
- Gogosoftware - http://welcome.to/gogosoftware/

- Raw text -


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