Mail Archives: djgpp/1998/12/18/05:30:06
igp AT vlc DOT servicom DOT es writes:
> I have two alternatives:
> 1- Load a keyboard map table from a .DAT file.
That is certainly the usual way to do this, and probably the most
least likely to be successful...
> In my case, load the spanish table, and everything works fine.
> But when the program goes to a foreign country, then the user
> will have to configure the keyboard, and what if there's no
> allegro keyboard map for that country ?...
Allegro currently ships with 14 different mappings, so there is a very
good chance that a suitable one will be included. If not, the best
solution is to contribute some additional ones: they are laborious but
not especially difficult to construct, and this work only needs to be
done once in order that everyone can benefit from it.
Having to manually select the mapping is certainly a pain, but I don't
know a reliable way to read the current settings from DOS. If you can
find some way to do this, it might be a good solution for your problem.
> 2- Use "install_keyboard_hooks" as the documentation says. But this
> works very badly. I've used the code:
>
> int my_keypressed(void) { return _bios_keybrd(_KEYBRD_READY); }
> int my_readkey(void) { return _bios_keybrd(_KEYBRD_READ); }
>
> install_keyboard_hooks((my_keypressed,my_readkey);
>
> But I get all the extended characters (above ASCII 127) wrong, and
> the extended keyboard works strangely too
Hmm, that ought to work, but I'm no expert on the BIOS keyboard input
routines. As far as Allegro is concerned, once you've installed these
hooks it will simply call my_readkey() in the place of the Allegro
readkey() code, so if this is returning the wrong data, it is the
fault of the BIOS functions that you use. I thought that
_bios_keybrd() would return data in the right format (ascii in low
byte, scancode in high byte), but evidently this is not entirely
correct. In any case, this method will work fine if you can find
a suitable routine to read input from the BIOS...
Shawn Hargreaves.
- Raw text -