Allow widgets to be selected by pressing Return, as well as Space.
This commit is contained in:
parent
e8748966a6
commit
de3dde7211
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue