Re: [AD] key scan codes have changed?

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


On Mon, 2005-05-02 at 07:40 +0200, Evert Glebbeek wrote:

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

Only ureadkey() returns unicode.. readkey() returns a ^ for unicode
chars I think.

> Personally I'm not sure that's desireable, since it's usually not what I 
> want when I'm controlling a game.

Yes, something else that needs to be looked at for 4.3 very much.
Additionally to the strange return values of readkey(), the 128 keys
limitation is too low (e.g. my keyboard has more if I count all the
multimedia/browser keys, even if I never use them).

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

Exactly. In the (short) testing I did, it seems to at least work on my
sytem..

-- 
Elias Pschernig





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