Re: [AD] Bug in exflame.c

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


Jason Wilkins <fenix@xxxxxxxxxx> writes:
> That still doesn't answer my question.  What format is the user expecting
> ureadkey input to be in?  Is it supposed to be the same format as 
> U_CURRENT?

It doesn't matter. You are just returning an integer value, which is the 
same in any character encoding. For instance if they type a lowercase 'a' 
with an accent (á), that is represented by 0xE1, so you just return 0xE1 as 
an int. It's only when that gets stored in memory as part of a string that 
the encoding format comes into play, for instance it could be:

   unsigned char ascii = 0xE1;
   unsigned short unicode = 0xE1;
   unsigned char utf8[] = "\xC3\xA1";

But the numeric value is always the same, and that's all that you are 
dealing with.

> So, alt should not cause keypressed() to return true? But under this
> definition, neither would alt-T.  If that is true then _do_menu() would 
> not be able to intrepret keyboard shortcuts.

Alt doesn't return anything on its own, but when you press T, that is a real 
key, and generates some real input. The definition of a modifier key is 
something like shift or alt, that has no effect on its own, but changes the 
meaning of whatever key you press next.

If in doubt, fire up the DOS version of exkeys and have a fiddle to see what 
everything returns.

> And, although the dos version does not get alt-tab, I would think that the
> Windows version does.  I don't recall there being any special code in its
> keyboard driver to handle that.

I would imagine that Windows steals this keypress before you get to see it. 
That's certainly the logical thing to do: if you do get to see the alt+tab 
input, we should add some code to filter it out.

> I never imagined how tedious and picky implementing a keyboard driver 
> would be ^_^

It's easy to get them working, but not so easy making them return all the 
right values.


--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."



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