SDL: Clean up key handling, change rewind key to backtick
Jeffrey Pfau jeffrey@endrift.com
Tue, 13 Jan 2015 03:02:36 -0800
1 files changed,
29 insertions(+),
32 deletions(-)
jump to
M
src/platform/sdl/sdl-events.c
→
src/platform/sdl/sdl-events.c
@@ -112,46 +112,43 @@ context->activeKeys &= ~(1 << key);
} return; } - switch (event->keysym.sym) { - case SDLK_F11: - if (event->type == SDL_KEYDOWN && context->debugger) { - ARMDebuggerEnter(context->debugger, DEBUGGER_ENTER_MANUAL); - } + if (event->keysym.sym == SDLK_TAB) { + context->sync.audioWait = event->type != SDL_KEYDOWN; return; + } + if (event->type == SDL_KEYDOWN) { + switch (event->keysym.sym) { + case SDLK_F11: + if (context->debugger) { + ARMDebuggerEnter(context->debugger, DEBUGGER_ENTER_MANUAL); + } + return; #ifdef USE_PNG - case SDLK_F12: - if (event->type == SDL_KEYDOWN) { + case SDLK_F12: GBAThreadInterrupt(context); GBAThreadTakeScreenshot(context); GBAThreadContinue(context); - } - return; + return; #endif - case SDLK_TAB: - context->sync.audioWait = event->type != SDL_KEYDOWN; - return; - case SDLK_BACKSLASH: - if (event->type == SDL_KEYDOWN) { + case SDLK_BACKSLASH: GBAThreadPause(context); context->frameCallback = _pauseAfterFrame; GBAThreadUnpause(context); - } - return; - case SDLK_LEFTBRACKET: - GBAThreadInterrupt(context); - GBARewind(context, 10); - GBAThreadContinue(context); - return; - case SDLK_ESCAPE: - GBAThreadInterrupt(context); - if (context->gba->rr) { - GBARRStopPlaying(context->gba->rr); - GBARRStopRecording(context->gba->rr); - } - GBAThreadContinue(context); - return; - default: - if (event->type == SDL_KEYDOWN) { + return; + case SDLK_BACKQUOTE: + GBAThreadInterrupt(context); + GBARewind(context, 10); + GBAThreadContinue(context); + return; + case SDLK_ESCAPE: + GBAThreadInterrupt(context); + if (context->gba->rr) { + GBARRStopPlaying(context->gba->rr); + GBARRStopRecording(context->gba->rr); + } + GBAThreadContinue(context); + return; + default: if ((event->keysym.mod & GUI_MOD) && (event->keysym.mod & GUI_MOD) == event->keysym.mod) { switch (event->keysym.sym) { #if SDL_VERSION_ATLEAST(2, 0, 0)@@ -238,8 +235,8 @@ default:
break; } } + return; } - return; } }