From 1f5579a6978badb06dd6c1d078a51f8dc0347bce Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Tue, 13 Aug 2013 23:04:46 +0200 Subject: [PATCH] Fix compilation with SDL2 Release .. they removed ev.key.keysym.unicode - but checking for SDL_SCANCODE_GRAVE is better anyway to handle console key --- neo/sys/sdl/sdl_events.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neo/sys/sdl/sdl_events.cpp b/neo/sys/sdl/sdl_events.cpp index 8764656a..4ed83410 100644 --- a/neo/sys/sdl/sdl_events.cpp +++ b/neo/sys/sdl/sdl_events.cpp @@ -887,7 +887,13 @@ sysEvent_t Sys_GetEvent() if( key == 0 ) { - +#if SDL_VERSION_ATLEAST(2, 0, 0) + // SDL2 has no ev.key.keysym.unicode anymore.. but the scancode should work well enough for console + if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open? + common->Warning( "unmapped SDL key %d scancode %d", ev.key.keysym.sym, ev.key.keysym.scancode ); + + return res_none; +#else unsigned char uc = ev.key.keysym.unicode & 0xff; // check if its an unmapped console key if( uc == Sys_GetConsoleKey( false ) || uc == Sys_GetConsoleKey( true ) ) @@ -901,6 +907,7 @@ sysEvent_t Sys_GetEvent() common->Warning( "unmapped SDL key %d (0x%x) scancode %d", ev.key.keysym.sym, ev.key.keysym.unicode, ev.key.keysym.scancode ); return res_none; } +#endif } }