www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/15/15:26:59

From: "Andrew Davidson" <andrew AT lemure DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Fast reading of multiple keypresses in Allegro
Date: Mon, 15 Feb 1999 20:26:35 -0000
Organization: Customer of Planet Online
Lines: 25
Message-ID: <7a9vkb$u46$1@news5.svr.pol.co.uk>
NNTP-Posting-Host: modem-74.rubidium.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 919110091 30854 62.136.18.74 (15 Feb 1999 20:21:31 GMT)
NNTP-Posting-Date: 15 Feb 1999 20:21:31 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.0810.800
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm a bit stuck trying to read a number of simultaneous key presses using
Allegro's key[] structure. The code goes roughly as follows:

if(keypressed()) {
    if(key[KEY_A]) set a flag;
    if(key[KEY_B]) set b flag;
    ...
    clear_keybuf();
}

So how can I get it to recognise that key 'a' may be held down continuously
whilst keys 'b' through 'z' are being pressed? Basically a funcition to sync
the key[] array with the current state of the keys pressed on the keyboard
is what I'm after. This function could be called at the start of the
if(keypressed()) section. BTW, does keypressed() respond only to the
depression of a key or is it constantly set if a key is held down? If not
I'll need some way to test if any keys are being currently held down too...

This all has to happen rather quickly and not make any noticable difference
to the speed of the overall program.

Anyway, thanks for any help in advance,
    Andrew


- Raw text -


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