Make Impl_SDL_Scancode_To_Keycode look a bit neater

This way it's easier by eye to see from the list which SDL scancode maps to which SRB2 key code
This commit is contained in:
Monster Iestyn 2016-11-23 17:08:37 +00:00
parent 5cf4767aed
commit 8bbbeff2a9

View file

@ -274,129 +274,70 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
} }
switch (code) switch (code)
{ {
case SDL_SCANCODE_F11: // F11 and F12 are // F11 and F12 are separated from the rest of the function keys
return KEY_F11; // separated from the case SDL_SCANCODE_F11: return KEY_F11;
case SDL_SCANCODE_F12: // rest of the function case SDL_SCANCODE_F12: return KEY_F12;
return KEY_F12; // keys
case SDL_SCANCODE_KP_0: case SDL_SCANCODE_KP_0: return KEY_KEYPAD0;
return KEY_KEYPAD0; case SDL_SCANCODE_KP_1: return KEY_KEYPAD1;
case SDL_SCANCODE_KP_1: case SDL_SCANCODE_KP_2: return KEY_KEYPAD2;
return KEY_KEYPAD1; case SDL_SCANCODE_KP_3: return KEY_KEYPAD3;
case SDL_SCANCODE_KP_2: case SDL_SCANCODE_KP_4: return KEY_KEYPAD4;
return KEY_KEYPAD2; case SDL_SCANCODE_KP_5: return KEY_KEYPAD5;
case SDL_SCANCODE_KP_3: case SDL_SCANCODE_KP_6: return KEY_KEYPAD6;
return KEY_KEYPAD3; case SDL_SCANCODE_KP_7: return KEY_KEYPAD7;
case SDL_SCANCODE_KP_4: case SDL_SCANCODE_KP_8: return KEY_KEYPAD8;
return KEY_KEYPAD4; case SDL_SCANCODE_KP_9: return KEY_KEYPAD9;
case SDL_SCANCODE_KP_5:
return KEY_KEYPAD5;
case SDL_SCANCODE_KP_6:
return KEY_KEYPAD6;
case SDL_SCANCODE_KP_7:
return KEY_KEYPAD7;
case SDL_SCANCODE_KP_8:
return KEY_KEYPAD8;
case SDL_SCANCODE_KP_9:
return KEY_KEYPAD9;
case SDL_SCANCODE_RETURN: case SDL_SCANCODE_RETURN: return KEY_ENTER;
return KEY_ENTER; case SDL_SCANCODE_ESCAPE: return KEY_ESCAPE;
case SDL_SCANCODE_ESCAPE: case SDL_SCANCODE_BACKSPACE: return KEY_BACKSPACE;
return KEY_ESCAPE; case SDL_SCANCODE_TAB: return KEY_TAB;
case SDL_SCANCODE_BACKSPACE: case SDL_SCANCODE_SPACE: return KEY_SPACE;
return KEY_BACKSPACE; case SDL_SCANCODE_MINUS: return KEY_MINUS;
case SDL_SCANCODE_TAB: case SDL_SCANCODE_EQUALS: return KEY_EQUALS;
return KEY_TAB; case SDL_SCANCODE_LEFTBRACKET: return '[';
case SDL_SCANCODE_SPACE: case SDL_SCANCODE_RIGHTBRACKET: return ']';
return KEY_SPACE; case SDL_SCANCODE_BACKSLASH: return '\\';
case SDL_SCANCODE_MINUS: case SDL_SCANCODE_NONUSHASH: return '#';
return KEY_MINUS; case SDL_SCANCODE_SEMICOLON: return ';';
case SDL_SCANCODE_EQUALS: case SDL_SCANCODE_APOSTROPHE: return '\'';
return KEY_EQUALS; case SDL_SCANCODE_GRAVE: return '`';
case SDL_SCANCODE_LEFTBRACKET: case SDL_SCANCODE_COMMA: return ',';
return '['; case SDL_SCANCODE_PERIOD: return '.';
case SDL_SCANCODE_RIGHTBRACKET: case SDL_SCANCODE_SLASH: return '/';
return ']'; case SDL_SCANCODE_CAPSLOCK: return KEY_CAPSLOCK;
case SDL_SCANCODE_BACKSLASH: case SDL_SCANCODE_PRINTSCREEN: return 0; // undefined?
return '\\'; case SDL_SCANCODE_SCROLLLOCK: return KEY_SCROLLLOCK;
case SDL_SCANCODE_NONUSHASH: case SDL_SCANCODE_PAUSE: return KEY_PAUSE;
return '#'; case SDL_SCANCODE_INSERT: return KEY_INS;
case SDL_SCANCODE_SEMICOLON: case SDL_SCANCODE_HOME: return KEY_HOME;
return ';'; case SDL_SCANCODE_PAGEUP: return KEY_PGUP;
case SDL_SCANCODE_APOSTROPHE: case SDL_SCANCODE_DELETE: return KEY_DEL;
return '\''; case SDL_SCANCODE_END: return KEY_END;
case SDL_SCANCODE_GRAVE: case SDL_SCANCODE_PAGEDOWN: return KEY_PGDN;
return '`'; case SDL_SCANCODE_RIGHT: return KEY_RIGHTARROW;
case SDL_SCANCODE_COMMA: case SDL_SCANCODE_LEFT: return KEY_LEFTARROW;
return ','; case SDL_SCANCODE_DOWN: return KEY_DOWNARROW;
case SDL_SCANCODE_PERIOD: case SDL_SCANCODE_UP: return KEY_UPARROW;
return '.'; case SDL_SCANCODE_NUMLOCKCLEAR: return KEY_NUMLOCK;
case SDL_SCANCODE_SLASH: case SDL_SCANCODE_KP_DIVIDE: return KEY_KPADSLASH;
return '/'; case SDL_SCANCODE_KP_MULTIPLY: return '*'; // undefined?
case SDL_SCANCODE_CAPSLOCK: case SDL_SCANCODE_KP_MINUS: return KEY_MINUSPAD;
return KEY_CAPSLOCK; case SDL_SCANCODE_KP_PLUS: return KEY_PLUSPAD;
case SDL_SCANCODE_PRINTSCREEN: case SDL_SCANCODE_KP_ENTER: return KEY_ENTER;
return 0; // undefined? case SDL_SCANCODE_KP_PERIOD: return KEY_KPADDEL;
case SDL_SCANCODE_SCROLLLOCK: case SDL_SCANCODE_NONUSBACKSLASH: return '\\';
return KEY_SCROLLLOCK;
case SDL_SCANCODE_PAUSE:
return KEY_PAUSE;
case SDL_SCANCODE_INSERT:
return KEY_INS;
case SDL_SCANCODE_HOME:
return KEY_HOME;
case SDL_SCANCODE_PAGEUP:
return KEY_PGUP;
case SDL_SCANCODE_DELETE:
return KEY_DEL;
case SDL_SCANCODE_END:
return KEY_END;
case SDL_SCANCODE_PAGEDOWN:
return KEY_PGDN;
case SDL_SCANCODE_RIGHT:
return KEY_RIGHTARROW;
case SDL_SCANCODE_LEFT:
return KEY_LEFTARROW;
case SDL_SCANCODE_DOWN:
return KEY_DOWNARROW;
case SDL_SCANCODE_UP:
return KEY_UPARROW;
case SDL_SCANCODE_NUMLOCKCLEAR:
return KEY_NUMLOCK;
case SDL_SCANCODE_KP_DIVIDE:
return KEY_KPADSLASH;
case SDL_SCANCODE_KP_MULTIPLY:
return '*'; // undefined?
case SDL_SCANCODE_KP_MINUS:
return KEY_MINUSPAD;
case SDL_SCANCODE_KP_PLUS:
return KEY_PLUSPAD;
case SDL_SCANCODE_KP_ENTER:
return KEY_ENTER;
case SDL_SCANCODE_KP_PERIOD:
return KEY_KPADDEL;
case SDL_SCANCODE_NONUSBACKSLASH:
return '\\';
case SDL_SCANCODE_LSHIFT: case SDL_SCANCODE_LSHIFT: return KEY_LSHIFT;
return KEY_LSHIFT; case SDL_SCANCODE_RSHIFT: return KEY_RSHIFT;
case SDL_SCANCODE_RSHIFT: case SDL_SCANCODE_LCTRL: return KEY_LCTRL;
return KEY_RSHIFT; case SDL_SCANCODE_RCTRL: return KEY_RCTRL;
case SDL_SCANCODE_LCTRL: case SDL_SCANCODE_LALT: return KEY_LALT;
return KEY_LCTRL; case SDL_SCANCODE_RALT: return KEY_RALT;
case SDL_SCANCODE_RCTRL: case SDL_SCANCODE_LGUI: return KEY_LEFTWIN;
return KEY_RCTRL; case SDL_SCANCODE_RGUI: return KEY_RIGHTWIN;
case SDL_SCANCODE_LALT: default: break;
return KEY_LALT;
case SDL_SCANCODE_RALT:
return KEY_RALT;
case SDL_SCANCODE_LGUI:
return KEY_LEFTWIN;
case SDL_SCANCODE_RGUI:
return KEY_RIGHTWIN;
default:
break;
} }
#ifdef HWRENDER #ifdef HWRENDER
DBG_Printf("Unknown incoming scancode: %d, represented %c\n", DBG_Printf("Unknown incoming scancode: %d, represented %c\n",