Add a few missing keys to libRocket keymap

libRocket calls some keys "OEM" which map to ASCII characters in
non-predictable places.  Since Panda3D is providing these values
to libRocket from well-known sources, it seems a lesser evil to
use the default US English mappings rather than losing the events
entirely.
This commit is contained in:
Ed Swartz 2015-05-30 21:56:50 -05:00
parent 586c067d69
commit 32bfe0bafc

View File

@ -113,6 +113,22 @@ get_rocket_key(const ButtonHandle handle) {
keymap[KeyboardButton::rshift().get_index()] = KI_RSHIFT;
keymap[KeyboardButton::scroll_lock().get_index()] = KI_SCROLL;
// these "OEM" keys have standard mappings in Panda3D
keymap[KeyboardButton::ascii_key(';').get_index()] = KI_OEM_1;
keymap[KeyboardButton::ascii_key('=').get_index()] = KI_OEM_PLUS;
keymap[KeyboardButton::ascii_key(',').get_index()] = KI_OEM_COMMA;
keymap[KeyboardButton::ascii_key('-').get_index()] = KI_OEM_MINUS;
keymap[KeyboardButton::ascii_key('.').get_index()] = KI_OEM_PERIOD;
keymap[KeyboardButton::ascii_key('/').get_index()] = KI_OEM_2;
keymap[KeyboardButton::ascii_key('`').get_index()] = KI_OEM_3;
keymap[KeyboardButton::ascii_key('[').get_index()] = KI_OEM_4;
keymap[KeyboardButton::ascii_key('\\').get_index()] = KI_OEM_5;
keymap[KeyboardButton::ascii_key(']').get_index()] = KI_OEM_6;
// comment says this may either be "<>" or "\|", but "\" (unshifted) is handled already,
// and "<" is only available "shifted" on 101-keyboards, so assume it's this one...
keymap[KeyboardButton::ascii_key('<').get_index()] = KI_OEM_102;
for (char c = 'a'; c <= 'z'; ++c) {
keymap[KeyboardButton::ascii_key(c).get_index()] = (c - 'a') + KI_A;
}