attempt to get underscore working.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4279 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-04-02 08:09:43 +00:00
parent 1e9af3f441
commit deb546d7b7

View file

@ -206,6 +206,159 @@ static unsigned int tbl_sdltoquake[] =
0 //SDLK_UNDO = 322, /* Atari keyboard has Undo */
};
#ifdef FTE_TARGET_WEB
//this matches my UK keymap. Sucks to be you if you're not british. Sorry. Blame emscripten.
static unsigned int tbl_sdlshifttounicode[] =
{
0,0,0,0, //SDLK_UNKNOWN = 0,
0,0,0,0, //SDLK_FIRST = 0,
K_BACKSPACE, //SDLK_BACKSPACE = 8,
K_TAB, //SDLK_TAB = 9,
0,0,
0, //SDLK_CLEAR = 12,
K_ENTER, //SDLK_RETURN = 13,
0,0,0,0,0,
K_PAUSE, //SDLK_PAUSE = 19,
0,0,0,0,0,0,0,
K_ESCAPE, //SDLK_ESCAPE = 27,
0,0,0,0,
K_SPACE, //SDLK_SPACE = 32,
'!', //SDLK_EXCLAIM = 33,
'"', //SDLK_QUOTEDBL = 34,
'~', //SDLK_HASH = 35,
'$', //SDLK_DOLLAR = 36,
0,
'&', //SDLK_AMPERSAND = 38,
'@', //SDLK_QUOTE = 39,
'(', //SDLK_LEFTPAREN = 40,
')', //SDLK_RIGHTPAREN = 41,
'*', //SDLK_ASTERISK = 42,
'+', //SDLK_PLUS = 43,
'<', //SDLK_COMMA = 44,
'_', //SDLK_MINUS = 45,
'>', //SDLK_PERIOD = 46,
'?', //SDLK_SLASH = 47,
')', //SDLK_0 = 48,
'!', //SDLK_1 = 49,
'\"', //SDLK_2 = 50,
L'£', //SDLK_3 = 51,
'$', //SDLK_4 = 52,
'%', //SDLK_5 = 53,
'^', //SDLK_6 = 54,
'&', //SDLK_7 = 55,
'*', //SDLK_8 = 56,
'(', //SDLK_9 = 57,
':', //SDLK_COLON = 58,
':', //SDLK_SEMICOLON = 59,
'<', //SDLK_LESS = 60,
'+', //SDLK_EQUALS = 61,
'>', //SDLK_GREATER = 62,
'?', //SDLK_QUESTION = 63,
'@', //SDLK_AT = 64,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
'{', //SDLK_LEFTBRACKET = 91,
'|', //SDLK_BACKSLASH = 92,
'}', //SDLK_RIGHTBRACKET = 93,
'^', //SDLK_CARET = 94,
'_', //SDLK_UNDERSCORE = 95,
L'¬', //SDLK_BACKQUOTE = 96,
'A', //SDLK_a = 97,
'B', //SDLK_b = 98,
'C', //SDLK_c = 99,
'D', //SDLK_d = 100,
'E', //SDLK_e = 101,
'F', //SDLK_f = 102,
'G', //SDLK_g = 103,
'H', //SDLK_h = 104,
'I', //SDLK_i = 105,
'J', //SDLK_j = 106,
'K', //SDLK_k = 107,
'L', //SDLK_l = 108,
'M', //SDLK_m = 109,
'N', //SDLK_n = 110,
'O', //SDLK_o = 111,
'P', //SDLK_p = 112,
'Q', //SDLK_q = 113,
'R', //SDLK_r = 114,
'S', //SDLK_s = 115,
'T', //SDLK_t = 116,
'U', //SDLK_u = 117,
'V', //SDLK_v = 118,
'W', //SDLK_w = 119,
'X', //SDLK_x = 120,
'Y', //SDLK_y = 121,
'Z', //SDLK_z = 122,
0,0,0,0,
K_DEL, //SDLK_DELETE = 127,
hundredoh /*227*/, tenoh, tenoh, 0,0,0,0,0,0,0,0,
K_KP_INS, //SDLK_KP0 = 256,
K_KP_END, //SDLK_KP1 = 257,
K_KP_DOWNARROW, //SDLK_KP2 = 258,
K_KP_PGDN, //SDLK_KP3 = 259,
K_KP_LEFTARROW, //SDLK_KP4 = 260,
K_KP_5, //SDLK_KP5 = 261,
K_KP_RIGHTARROW, //SDLK_KP6 = 262,
K_KP_HOME, //SDLK_KP7 = 263,
K_KP_UPARROW, //SDLK_KP8 = 264,
K_KP_PGUP, //SDLK_KP9 = 265,
K_KP_DEL,//SDLK_KP_PERIOD = 266,
K_KP_SLASH,//SDLK_KP_DIVIDE = 267,
K_KP_STAR,//SDLK_KP_MULTIPLY= 268,
K_KP_MINUS, //SDLK_KP_MINUS = 269,
K_KP_PLUS, //SDLK_KP_PLUS = 270,
K_KP_ENTER, //SDLK_KP_ENTER = 271,
K_KP_EQUALS,//SDLK_KP_EQUALS = 272,
K_UPARROW, //SDLK_UP = 273,
K_DOWNARROW,//SDLK_DOWN = 274,
K_RIGHTARROW,//SDLK_RIGHT = 275,
K_LEFTARROW,//SDLK_LEFT = 276,
K_INS, //SDLK_INSERT = 277,
K_HOME, //SDLK_HOME = 278,
K_END, //SDLK_END = 279,
K_PGUP, //SDLK_PAGEUP = 280,
K_PGDN, //SDLK_PAGEDOWN = 281,
K_F1, //SDLK_F1 = 282,
K_F2, //SDLK_F2 = 283,
K_F3, //SDLK_F3 = 284,
K_F4, //SDLK_F4 = 285,
K_F5, //SDLK_F5 = 286,
K_F6, //SDLK_F6 = 287,
K_F7, //SDLK_F7 = 288,
K_F8, //SDLK_F8 = 289,
K_F9, //SDLK_F9 = 290,
K_F10, //SDLK_F10 = 291,
K_F11, //SDLK_F11 = 292,
K_F12, //SDLK_F12 = 293,
0, //SDLK_F13 = 294,
0, //SDLK_F14 = 295,
0, //SDLK_F15 = 296,
0,0,0,
0,//K_NUMLOCK, //SDLK_NUMLOCK = 300,
K_CAPSLOCK, //SDLK_CAPSLOCK = 301,
0,//K_SCROLLOCK,//SDLK_SCROLLOCK= 302,
K_SHIFT, //SDLK_RSHIFT = 303,
K_SHIFT, //SDLK_LSHIFT = 304,
K_CTRL, //SDLK_RCTRL = 305,
K_CTRL, //SDLK_LCTRL = 306,
K_ALT, //SDLK_RALT = 307,
K_ALT, //SDLK_LALT = 308,
0, //SDLK_RMETA = 309,
0, //SDLK_LMETA = 310,
0, //SDLK_LSUPER = 311, /* Left "Windows" key */
0, //SDLK_RSUPER = 312, /* Right "Windows" key */
0, //SDLK_MODE = 313, /* "Alt Gr" key */
0, //SDLK_COMPOSE = 314, /* Multi-key compose key */
0, //SDLK_HELP = 315,
0, //SDLK_PRINT = 316,
0, //SDLK_SYSREQ = 317,
K_PAUSE, //SDLK_BREAK = 318,
0, //SDLK_MENU = 319,
0, //SDLK_POWER = 320, /* Power Macintosh power key */
'e', //SDLK_EURO = 321, /* Some european keyboards */
0 //SDLK_UNDO = 322, /* Atari keyboard has Undo */
};
#endif
static unsigned int tbl_sdltoquakemouse[] =
{
K_MOUSE1,
@ -259,13 +412,25 @@ void Sys_SendKeyEvents(void)
qs = tbl_sdltoquake[s];
else
qs = 0;
#ifdef FTE_TARGET_WEB
if (s == 1249)
qs = K_SHIFT;
//emscripten doesn't support unicode, but does pretend to. override it so we get something usable.
u = qs;
if (u < 32 || u > 127)
u = 0;
u = 0;
extern qboolean shift_down;
if (shift_down)
{
if (s < sizeof(tbl_sdlshifttounicode) / sizeof(tbl_sdlshifttounicode[0]))
u = tbl_sdlshifttounicode[s];
}
else
{
if (s < sizeof(tbl_sdltoquake) / sizeof(tbl_sdltoquake[0]))
u = tbl_sdltoquake[s];
}
#endif
IN_KeyEvent(0, event.key.state, s, u);
IN_KeyEvent(0, event.key.state, qs, u);
}
break;