delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/03/14:30:06

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro: 3 button keyboard handler?? THAT SUCKS!!!
Date: 3 May 1997 13:52:54 GMT
Organization: Oxford University, England
Lines: 44
Message-ID: <5kffvm$kv9@news.ox.ac.uk>
References: <5keie7$2fn$1 AT thor DOT atcon DOT com>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

SteelGolem (myork AT auracom DOT com) wrote:
: i have a [non]protected mode keyboard handler that handles X number of
: keys.. if i display it, can someone show me how to change it so it works
: under djgpp protected mode?? or am i screwed?

You could, but Allegro's is better anyway.

: *** end of c file.. its a horrible program, but it works. is there a
: keyboard handler that will do THIS, instead of the sucky 3 button
: handler allegro has? don't get me wrong, allegro is awesome, but i'd
: rather have a better keyboard handler.. 3 buttons.. what do they think
: we are, ANIMALS???

Hmm. Allegro's keyboard handler *can* simultaneously track the up/down
state of every key on the keyboard; it's just that the standard PC
keyboard can't do this. Try the following:

#include <stdio.h>
#include <allegro.h>

int main()
{
 int x;
 allegro_init();
 install_keyboard();
 while (!key[KEY_ESC]) {
  for (x=0;x<128;x++) if (key[x]) printf("%3d ",x);
  printf("\n");
 }
 return 0;
}

Then run it and hold down a few keys. You should find that it can track
quite a few, but some combinations `clash'. I doubt your keyboard handler
you posted could track these combinations any better than Allegro's
could, because fundamentally they're both doing it in the same way.

The only solution to your problem is to allow the end-user to customise
the controls; that way they can pick a combination that doesn't clash on
their keyboard. Different keyboards are very different in this respect.

-- 
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