Add missing SDL keycode translation pairs

This commit is contained in:
Daniel Dressler 2013-06-30 22:25:16 -07:00
parent a51474d255
commit 91114ba605
3 changed files with 69 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#include "util/const_map.h"
#include <map>
// TODO: fill out this with a full mapping
// TODO: Add any missing keys
static const std::map<int, int> KeyMapRawSDLtoNative = InitConstMap<int, int>
(SDLK_p, KEYCODE_P)
(SDLK_o, KEYCODE_O)
@ -28,5 +28,68 @@ static const std::map<int, int> KeyMapRawSDLtoNative = InitConstMap<int, int>
(SDLK_v, KEYCODE_V)
(SDLK_c, KEYCODE_C)
(SDLK_x, KEYCODE_X)
(SDLK_z, KEYCODE_Z);
(SDLK_z, KEYCODE_Z)
(SDLK_COMMA, KEYCODE_COMMA)
(SDLK_PERIOD, KEYCODE_PERIOD)
(SDLK_LALT, KEYCODE_ALT_LEFT)
(SDLK_RALT, KEYCODE_ALT_RIGHT)
(SDLK_LSHIFT, KEYCODE_SHIFT_LEFT)
(SDLK_RSHIFT, KEYCODE_SHIFT_RIGHT)
(SDLK_TAB, KEYCODE_TAB)
(SDLK_SPACE, KEYCODE_SPACE)
(SDLK_RETURN, KEYCODE_ENTER)
(SDLK_MINUS, KEYCODE_MINUS)
(SDLK_EQUALS, KEYCODE_EQUALS)
(SDLK_LEFTBRACKET, KEYCODE_LEFT_BRACKET)
(SDLK_RIGHTBRACKET, KEYCODE_RIGHT_BRACKET)
(SDLK_BACKSLASH, KEYCODE_BACKSLASH)
(SDLK_SEMICOLON, KEYCODE_SEMICOLON)
// (SDLK_, KEYCODE_APOSTROPHE) // I cannot find the SDL equiv
(SDLK_SLASH, KEYCODE_SLASH)
(SDLK_AT, KEYCODE_AT)
(SDLK_PLUS, KEYCODE_PLUS)
(SDLK_PAGEUP, KEYCODE_PAGE_UP)
(SDLK_PAGEDOWN, KEYCODE_PAGE_DOWN)
(SDLK_ESCAPE, KEYCODE_ESCAPE)
(SDLK_DELETE, KEYCODE_FORWARD_DEL)
(SDLK_LCTRL, KEYCODE_CTRL_LEFT)
(SDLK_RCTRL, KEYCODE_CTRL_RIGHT)
(SDLK_CAPSLOCK, KEYCODE_CAPS_LOCK)
(SDLK_HOME, KEYCODE_MOVE_HOME)
(SDLK_END, KEYCODE_MOVE_END)
(SDLK_INSERT, KEYCODE_INSERT)
/* Somehow these are undefined
* on my comp?
(SDLK_KP_0, KEYCODE_NUMPAD_0)
(SDLK_KP_1, KEYCODE_NUMPAD_1)
(SDLK_KP_2, KEYCODE_NUMPAD_2)
(SDLK_KP_3, KEYCODE_NUMPAD_3)
(SDLK_KP_4, KEYCODE_NUMPAD_4)
(SDLK_KP_5, KEYCODE_NUMPAD_5)
(SDLK_KP_6, KEYCODE_NUMPAD_6)
(SDLK_KP_7, KEYCODE_NUMPAD_7)
(SDLK_KP_8, KEYCODE_NUMPAD_8)
(SDLK_KP_9, KEYCODE_NUMPAD_9)
*/
(SDLK_KP_DIVIDE, KEYCODE_NUMPAD_DIVIDE)
(SDLK_KP_MULTIPLY, KEYCODE_NUMPAD_MULTIPLY)
(SDLK_KP_MINUS, KEYCODE_NUMPAD_SUBTRACT)
(SDLK_KP_PLUS, KEYCODE_NUMPAD_ADD)
(SDLK_KP_PERIOD, KEYCODE_NUMPAD_DOT)
(SDLK_KP_ENTER, KEYCODE_NUMPAD_ENTER)
(SDLK_KP_EQUALS, KEYCODE_NUMPAD_EQUALS)
(SDLK_1, KEYCODE_1)
(SDLK_2, KEYCODE_2)
(SDLK_3, KEYCODE_3)
(SDLK_4, KEYCODE_4)
(SDLK_5, KEYCODE_5)
(SDLK_6, KEYCODE_6)
(SDLK_7, KEYCODE_7)
(SDLK_8, KEYCODE_8)
(SDLK_9, KEYCODE_9)
(SDLK_0, KEYCODE_0)
(SDLK_LEFT, KEYCODE_DPAD_LEFT)
(SDLK_UP, KEYCODE_DPAD_UP)
(SDLK_RIGHT, KEYCODE_DPAD_RIGHT)
(SDLK_DOWN, KEYCODE_DPAD_DOWN);

View File

@ -289,10 +289,12 @@ void SimulateGamepad(const uint8 *keys, InputState *input) {
input->pad_lstick_y = 0;
input->pad_rstick_x = 0;
input->pad_rstick_y = 0;
/*
for (int b = 0; b < 14; b++) {
if (keys[buttonMappings[b]])
input->pad_buttons |= (1<<b);
}
*/
#ifdef PANDORA
if ((ljoy)||(rjoy)) {

View File

@ -74,7 +74,8 @@ void KeyQueueAttemptTranslatedAdd(int queue[],
int key = AttemptTranslate(translation_table, platform_key);
if (key == 0) {
std::cerr << "Warning: Platform key code translation table missing %d";
std::cerr << "Warning: Platform key code translation table missing "
<< "(" << platform_key << ")\n";
return;
}