SDL: Clean up key handling, change rewind key to backtick

This commit is contained in:
Jeffrey Pfau 2015-01-13 03:02:36 -08:00
parent b9623efc0c
commit c05b166469
1 changed files with 29 additions and 32 deletions

View File

@ -112,32 +112,30 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
}
return;
}
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 (event->type == SDL_KEYDOWN && context->debugger) {
if (context->debugger) {
ARMDebuggerEnter(context->debugger, DEBUGGER_ENTER_MANUAL);
}
return;
#ifdef USE_PNG
case SDLK_F12:
if (event->type == SDL_KEYDOWN) {
GBAThreadInterrupt(context);
GBAThreadTakeScreenshot(context);
GBAThreadContinue(context);
}
return;
#endif
case SDLK_TAB:
context->sync.audioWait = event->type != SDL_KEYDOWN;
return;
case SDLK_BACKSLASH:
if (event->type == SDL_KEYDOWN) {
GBAThreadPause(context);
context->frameCallback = _pauseAfterFrame;
GBAThreadUnpause(context);
}
return;
case SDLK_LEFTBRACKET:
case SDLK_BACKQUOTE:
GBAThreadInterrupt(context);
GBARewind(context, 10);
GBAThreadContinue(context);
@ -151,7 +149,6 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
GBAThreadContinue(context);
return;
default:
if (event->type == SDL_KEYDOWN) {
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,9 +235,9 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
break;
}
}
}
return;
}
}
}
static void _GBASDLHandleJoyButton(struct GBAThread* context, struct GBASDLEvents* sdlContext, const struct SDL_JoyButtonEvent* event) {