diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index 30626c8d..666725c7 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -155,22 +155,32 @@ int getKeyState( int k ) static int _keyonly (int a) { - // check for valid key - if (a > SDLK_LAST + 1 || a < 0) + int sc; + + if ( a < 0 ) { return 0; } - if (g_keyState[SDL_GetScancodeFromKey (a)]) + sc = SDL_GetScancodeFromKey(a); + + // check for valid key + if (sc >= SDL_NUM_SCANCODES || sc < 0) { - if (!keyonce[a]) + return 0; + } + + if (g_keyState[sc]) + { + if (!keyonce[sc]) { - keyonce[a] = 1; + keyonce[sc] = 1; return 1; } } - else { - keyonce[a] = 0; + else + { + keyonce[sc] = 0; } return 0; } diff --git a/src/drivers/sdl/keyscan.h b/src/drivers/sdl/keyscan.h index 0a73804b..b3973c20 100644 --- a/src/drivers/sdl/keyscan.h +++ b/src/drivers/sdl/keyscan.h @@ -42,7 +42,3 @@ #define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */ #define SDLK_GRAVE SDLK_BACKQUOTE #define MKK(k) SDLK_##k -#if SDL_VERSION_ATLEAST(2, 0, 0) -#define SDLK_LAST SDL_NUM_SCANCODES -#endif -#define MKK_COUNT (SDLK_LAST+1) diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 137a1deb..6859af71 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -172,13 +172,9 @@ static void ShowUsage(char *prog) #endif puts(""); printf("Compiled with SDL version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL ); -#if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_version* v; - SDL_GetVersion(v); -#else - const SDL_version* v = SDL_Linked_Version(); -#endif - printf("Linked with SDL version %d.%d.%d\n", v->major, v->minor, v->patch); + SDL_version v; + SDL_GetVersion(&v); + printf("Linked with SDL version %d.%d.%d\n", v.major, v.minor, v.patch); #ifdef GTK printf("Compiled with GTK version %d.%d.%d\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION ); //printf("Linked with GTK version %d.%d.%d\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION ); @@ -680,41 +676,6 @@ int main(int argc, char *argv[]) int yres, xres; g_config->getOption("SDL.XResolution", &xres); g_config->getOption("SDL.YResolution", &yres); -#if SDL_VERSION_ATLEAST(2, 0, 0) - // TODO _ SDL 2.0 -#else - const SDL_VideoInfo* vid_info = SDL_GetVideoInfo(); - if(xres == 0) - { - if(vid_info != NULL) - { - g_config->setOption("SDL.LastXRes", vid_info->current_w); - } - else - { - g_config->setOption("SDL.LastXRes", 512); - } - } - else - { - g_config->setOption("SDL.LastXRes", xres); - } - if(yres == 0) - { - if(vid_info != NULL) - { - g_config->setOption("SDL.LastYRes", vid_info->current_h); - } - else - { - g_config->setOption("SDL.LastYRes", 448); - } - } - else - { - g_config->setOption("SDL.LastYRes", yres); - } -#endif int autoResume; g_config->getOption("SDL.AutoResume", &autoResume);