Re: [AD] key scan codes have changed?

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


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.


it currently does, therefore "i think" its a bug.


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

if i want to test for alt-c do i go if ( readkey() == 0xfc7e ) or do i go if (( (readkey()&0xff) == 7e ) && ( keyshifts & ALT_FLAG )) ??????


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



so now the docs are the official source for what is to be.
sometimes its the src, and the docs are wrong, sometimes its the docs and the source is wrong. sometimes a merry-go-round makes you want to vomit... :|




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