Fix some keys in SDL

This commit is contained in:
Iwan Timmer 2015-08-09 22:34:48 +02:00
parent 92112f292a
commit abc9a19a9d
2 changed files with 4 additions and 3 deletions

View File

@ -43,7 +43,7 @@ static int keyboard_modifiers;
void sdlinput_init() {
memset(gamepads, 0, sizeof(gamepads));
SDL_SetRelativeMouseMode(SDL_TRUE);
//SDL_SetRelativeMouseMode(SDL_TRUE);
SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
@ -101,9 +101,9 @@ bool sdlinput_handle_event(SDL_Event* event) {
case SDL_KEYDOWN:
case SDL_KEYUP:
button = event->key.keysym.sym;
if (button >= (0x40000000 + 0x39) && button < (0x40000000 + sizeof(keyCodes)))
if (button >= (0x40000000 + 0x39) && button < (0x40000000 + 0x39 + sizeof(keyCodes)))
button = keyCodes[button - 0x40000039];
if (button >= 0x61)
else if (button >= 0x61)
button -= 0x20;
int modifier = 0;

View File

@ -42,6 +42,7 @@ static const short keyCodes[] = {
0x9B, //SDLK_INSERT
0x24, //SDLK_HOME
0x21, //SDLK_PAGEUP
0, //Not used
0x23, //SDLK_END
0x22, //SDLK_PAGEDOWN
0x27, //SDLK_RIGHT