Allow widgets to be selected by pressing Return, as well as Space.

This commit is contained in:
Steve 2016-02-15 14:08:13 +00:00
parent e8748966a6
commit de3dde7211
1 changed files with 4 additions and 2 deletions

View File

@ -236,18 +236,20 @@ static void handleKeyboard(void)
{ {
Widget *old; Widget *old;
if (app.keyboard[SDL_SCANCODE_SPACE]) if (app.keyboard[SDL_SCANCODE_SPACE] ||app.keyboard[SDL_SCANCODE_RETURN])
{ {
if (selectedWidget != NULL && selectedWidget->type == WT_BUTTON) if (selectedWidget != NULL && selectedWidget->type == WT_BUTTON)
{ {
playSound(SND_GUI_SELECT); playSound(SND_GUI_SELECT);
old = selectedWidget; old = selectedWidget;
selectedWidget->action(); selectedWidget->action();
if (old == selectedWidget) if (old == selectedWidget)
{ {
selectedWidget = NULL; selectedWidget = NULL;
} }
app.keyboard[SDL_SCANCODE_SPACE] = 0;
app.keyboard[SDL_SCANCODE_SPACE] = app.keyboard[SDL_SCANCODE_RETURN] = 0;
} }
} }
} }