Re: [AD] key scan codes have changed?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Monday 02 May 2005 07:07, AJ wrote:
> i had a fully functional keyboard system working; with 4.1.18  i have 
> now upgraded to 4.2 b2 and  many of the keys have changed.

4.2 uses a different keyboard driver than 4.1.18

> so without knowing what keys should return what.. the question is, 
> should 4.2b2 readkey() produce different results than 4.1.18's 
readkey() ?

I don't think so.

> some of what you are saying seems to be "its supposed to return XXX" 
> which then implies that 4.1.18 was broken.

What it's supposed to return is what is in the documentation:

          val = readkey();
          if ((val & 0xff) == 'd')     /* by ASCII code */
             allegro_message("You pressed 'd'\n");

          if ((val >> 8) == KEY_SPACE) /* by scancode */
             allegro_message("You pressed Space\n");

          if ((val & 0xff) == 3)       /* ctrl+letter */
             allegro_message("You pressed Control+C\n");

          if (val == (KEY_X << 8))     /* alt+letter */
             allegro_message("You pressed Alt+X\n");

Now, there may be subtle differences due to returning proper unicode 
characters (it does, right?) and composite characters (through alt-gr). 
Personally I'm not sure that's desireable, since it's usually not what I 
want when I'm controlling a game.

> should i be just using the ascii portion, and combining that with the 
> flags to test for modifier+key pairs ?
> previously i have been just using readkey().

Not sure what you mean... what I quoted above from the docs is the expected 
behavior. If that's not what you get, it's a bug.

Evert




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/