Merge pull request #49 from digarok/fix_keymap_intl

use SDL keycode whenever possible
This commit is contained in:
Dagen Brock 2018-08-31 10:30:59 -05:00 committed by GitHub
commit 489f1310a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ void handle_sdl_mouse_event(SDL_Event event);
int g_num_a2_keycodes = 0; int g_num_a2_keycodes = 0;
int a2_key_to_sdlkeycode[][3] = { int a2_key_to_sdlkeycode[][3] = {
{ 0x35, SDLK_ESCAPE,0 }, { 0x35, SDLK_ESCAPE, 0 },
{ 0x7a, SDLK_F1, 0 }, { 0x7a, SDLK_F1, 0 },
{ 0x78, SDLK_F2, 0 }, { 0x78, SDLK_F2, 0 },
{ 0x63, SDLK_F3, 0 }, { 0x63, SDLK_F3, 0 },
@ -109,98 +109,97 @@ int a2_key_to_sdlkeycode[][3] = {
{ 0x69, SDLK_F13, 0 }, { 0x69, SDLK_F13, 0 },
{ 0x6b, SDLK_F14, 0 }, { 0x6b, SDLK_F14, 0 },
{ 0x71, SDLK_F15, 0 }, { 0x71, SDLK_F15, 0 },
{ 0x7f, SDLK_PAUSE, 0 }, { 0x7f, SDLK_PAUSE, 0 },
{ 0x32, '`', '~' }, /* Key number 18? */ { 0x32, SDLK_BACKQUOTE, '~' }, /* Key number 18? */
{ 0x12, '1', '!' }, { 0x12, SDLK_1, '!' },
{ 0x13, '2', '@' }, { 0x13, SDLK_2, '@' },
{ 0x14, '3', '#' }, { 0x14, SDLK_3, '#' },
{ 0x15, '4', '$' }, { 0x15, SDLK_4, '$' },
{ 0x17, '5', '%' }, { 0x17, SDLK_5, '%' },
{ 0x16, '6', '^' }, { 0x16, SDLK_6, '^' },
{ 0x1a, '7', '&' }, { 0x1a, SDLK_7, '&' },
{ 0x1c, '8', '*' }, { 0x1c, SDLK_8, '*' },
{ 0x19, '9', '(' }, { 0x19, SDLK_9, '(' },
{ 0x1d, '0', ')' }, { 0x1d, SDLK_0, ')' },
{ 0x1b, '-', '_' }, { 0x1b, SDLK_MINUS, SDLK_UNDERSCORE },
{ 0x18, '=', '+' }, { 0x18, SDLK_EQUALS, SDLK_PLUS },
{ 0x33, SDLK_BACKSPACE, 0 }, { 0x33, SDLK_BACKSPACE, 0 },
{ 0x72, SDLK_INSERT, 0 }, /* Help? XK_Help */ { 0x72, SDLK_INSERT, 0 }, /* Help? XK_Help */
/* { 0x73, XK_Home, 0 }, alias XK_Home to be XK_KP_Equal! */ /* { 0x73, XK_Home, 0 }, alias XK_Home to be XK_KP_Equal! */
{ 0x74, SDLK_PAGEUP, 0 }, { 0x74, SDLK_PAGEUP, 0 },
{ 0x47, SDLK_NUMLOCKCLEAR, 0 }, /* Clear, XK_Clear */ { 0x47, SDLK_NUMLOCKCLEAR, 0 }, /* Clear, XK_Clear */
{ 0x51, SDLK_KP_EQUALS, 0 }, /* Note XK_Home alias! XK_Home */ { 0x51, SDLK_KP_EQUALS, 0 }, /* Note XK_Home alias! XK_Home */
{ 0x4b, SDLK_KP_DIVIDE, 0 }, { 0x4b, SDLK_KP_DIVIDE, 0 },
{ 0x43, SDLK_KP_MULTIPLY, 0 }, { 0x43, SDLK_KP_MULTIPLY, 0 },
{ 0x30, SDLK_TAB, 0 }, { 0x30, SDLK_TAB, 0 },
{ 0x0c, 'q', 'Q' }, { 0x0c, SDLK_q, 'Q' },
{ 0x0d, 'w', 'W' }, { 0x0d, SDLK_w, 'W' },
{ 0x0e, 'e', 'E' }, { 0x0e, SDLK_e, 'E' },
{ 0x0f, 'r', 'R' }, { 0x0f, SDLK_r, 'R' },
{ 0x11, 't', 'T' }, { 0x11, SDLK_t, 'T' },
{ 0x10, 'y', 'Y' }, { 0x10, SDLK_y, 'Y' },
{ 0x20, 'u', 'U' }, { 0x20, SDLK_u, 'U' },
{ 0x22, 'i', 'I' }, { 0x22, SDLK_i, 'I' },
{ 0x1f, 'o', 'O' }, { 0x1f, SDLK_o, 'O' },
{ 0x23, 'p', 'P' }, { 0x23, SDLK_p, 'P' },
{ 0x21, '[', '{' }, { 0x21, SDLK_RIGHTBRACKET, '{' },
{ 0x1e, ']', '}' }, { 0x1e, SDLK_LEFTBRACKET, '}' },
{ 0x2a, 0x5c, '|' }, /* backslash, bar */ { 0x2a, SDLK_BACKSLASH, '|' }, /* backslash, bar */
{ 0x75, SDLK_DELETE, 0 }, { 0x75, SDLK_DELETE, 0 },
{ 0x77, SDLK_END, 0 }, { 0x77, SDLK_END, 0 },
{ 0x79, SDLK_PAGEDOWN, 0 }, { 0x79, SDLK_PAGEDOWN, 0 },
{ 0x59, SDLK_KP_7, SDLK_HOME }, { 0x59, SDLK_KP_7, SDLK_HOME },
{ 0x5b, SDLK_KP_8, SDLK_UP }, { 0x5b, SDLK_KP_8, SDLK_UP },
{ 0x5c, SDLK_KP_9, SDLK_PAGEUP }, { 0x5c, SDLK_KP_9, SDLK_PAGEUP },
{ 0x4e, SDLK_KP_MINUS, 0 }, { 0x4e, SDLK_KP_MINUS, 0 },
{ 0x39, SDLK_CAPSLOCK, 0 }, { 0x39, SDLK_CAPSLOCK, 0 },
{ 0x00, 'a', 'A' }, { 0x00, SDLK_a, 'A' },
{ 0x01, 's', 'S' }, { 0x01, SDLK_s, 'S' },
{ 0x02, 'd', 'D' }, { 0x02, SDLK_d, 'D' },
{ 0x03, 'f', 'F' }, { 0x03, SDLK_f, 'F' },
{ 0x05, 'g', 'G' }, { 0x05, SDLK_g, 'G' },
{ 0x04, 'h', 'H' }, { 0x04, SDLK_h, 'H' },
{ 0x26, 'j', 'J' }, { 0x26, SDLK_j, 'J' },
{ 0x28, 'k', 'K' }, { 0x28, SDLK_k, 'K' },
{ 0x25, 'l', 'L' }, { 0x25, SDLK_l, 'L' },
{ 0x29, ';', ':' }, { 0x29, SDLK_SEMICOLON, SDLK_COLON },
{ 0x27, 0x27, '"' }, /* single quote */ { 0x27, SDLK_QUOTE, SDLK_QUOTEDBL },
{ 0x24, SDLK_RETURN, 0 }, { 0x24, SDLK_RETURN, 0 },
{ 0x56, SDLK_KP_4, SDLK_LEFT}, { 0x56, SDLK_KP_4, SDLK_LEFT},
{ 0x57, SDLK_KP_5, 0 }, { 0x57, SDLK_KP_5, 0 },
{ 0x58, SDLK_KP_6, SDLK_RIGHT }, { 0x58, SDLK_KP_6, SDLK_RIGHT },
{ 0x45, SDLK_KP_PLUS, 0 }, { 0x45, SDLK_KP_PLUS, 0 },
{ 0x38, SDLK_LSHIFT, SDLK_RSHIFT }, { 0x38, SDLK_LSHIFT, SDLK_RSHIFT },
{ 0x06, 'z', 'Z' }, { 0x06, SDLK_z, 'Z' },
{ 0x07, 'x', 'X' }, { 0x07, SDLK_x, 'X' },
{ 0x08, 'c', 'C' }, { 0x08, SDLK_c, 'C' },
{ 0x09, 'v', 'V' }, { 0x09, SDLK_v, 'V' },
{ 0x0b, 'b', 'B' }, { 0x0b, SDLK_b, 'B' },
{ 0x2d, 'n', 'N' }, { 0x2d, SDLK_n, 'N' },
{ 0x2e, 'm', 'M' }, { 0x2e, SDLK_m, 'M' },
{ 0x2b, ',', '<' }, { 0x2b, SDLK_COMMA, SDLK_LESS },
{ 0x2f, '.', '>' }, { 0x2f, SDLK_PERIOD, SDLK_GREATER },
{ 0x2c, '/', '?' }, { 0x2c, SDLK_SLASH, SDLK_QUESTION },
{ 0x3e, SDLK_UP, 0 }, { 0x3e, SDLK_UP, 0 },
{ 0x53, SDLK_KP_1, 0 }, { 0x53, SDLK_KP_1, 0 },
{ 0x54, SDLK_KP_2, SDLK_DOWN }, { 0x54, SDLK_KP_2, SDLK_DOWN },
{ 0x55, SDLK_KP_3, SDLK_PAGEDOWN }, { 0x55, SDLK_KP_3, SDLK_PAGEDOWN },
{ 0x36, SDLK_RCTRL, SDLK_LCTRL }, { 0x36, SDLK_RCTRL, SDLK_LCTRL },
#if defined(__APPLE__) #if defined(__APPLE__)
{ 0x3a, SDLK_LALT, SDLK_RALT }, /* Option */ { 0x3a, SDLK_LALT, SDLK_RALT }, /* Option */
{ 0x37, SDLK_LGUI, SDLK_RGUI }, /* Command */ { 0x37, SDLK_LGUI, SDLK_RGUI }, /* Command */
#else #else
{ 0x3a, SDLK_LGUI, SDLK_RGUI }, /* Command */ { 0x3a, SDLK_LGUI, SDLK_RGUI }, /* Command */
{ 0x37, SDLK_LALT, SDLK_RALT }, /* Option */ { 0x37, SDLK_LALT, SDLK_RALT }, /* Option */
#endif #endif
{ 0x31, ' ', 0 }, { 0x31, SDLK_SPACE, 0 },
{ 0x3b, SDLK_LEFT, 0 }, { 0x3b, SDLK_LEFT, 0 },
{ 0x3d, SDLK_DOWN, 0 }, { 0x3d, SDLK_DOWN, 0 },
{ 0x3c, SDLK_RIGHT, 0 }, { 0x3c, SDLK_RIGHT, 0 },
{ 0x52, SDLK_KP_0, 0 }, { 0x52, SDLK_KP_0, 0 },
{ 0x41, SDLK_KP_PERIOD, 0 }, { 0x41, SDLK_KP_PERIOD, 0 },
{ 0x4c, SDLK_KP_ENTER, 0 }, { 0x4c, SDLK_KP_ENTER, 0 },
{ -1, -1, -1 } { -1, -1, -1 }
}; };