1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Translate menu options on-the-fly

I saw that the only problem with cycling languages in a title screen
menu is that the menu options don't get updated. So I was like, we can
just recreate the menu, and then I was like "Sure, why not." So that's
what I did.

To accommodate the CTRL+F8 keybind in the language menu, it
automatically updates the menu option when you cycle it. This is because
otherwise using the keybind in the language menu wouldn't visibly update
the language, but it still actually does change your language, and that
can be seen by pressing Escape.

Also, the menucountdown needs to be preserved because otherwise
createmenu() resets it, even if it's the "same" menu (this behavior is
needed so that the menu that is shown during the countdown isn't added
as a stack frame which would make it a menu that could be returned to).
This commit is contained in:
Misa 2024-01-21 17:26:55 -08:00 committed by Misa Elizabeth Kai
parent c173dec8f9
commit 531b151d12

View file

@ -187,8 +187,7 @@ void KeyPoll::Poll(void)
{ {
if (keymap[SDLK_LCTRL]) if (keymap[SDLK_LCTRL])
{ {
/* Debug keybind to cycle language. /* Debug keybind to cycle language. */
* Not really meant to be used inside menus. */
int i = loc::languagelist_curlang; int i = loc::languagelist_curlang;
if (keymap[SDLK_LSHIFT]) if (keymap[SDLK_LSHIFT])
{ {
@ -211,6 +210,18 @@ void KeyPoll::Poll(void)
should_recompute_textboxes = true; should_recompute_textboxes = true;
} }
if (game.gamestate == TITLEMODE)
{
int temp = game.menucountdown;
game.createmenu(game.currentmenuname, true);
game.menucountdown = temp;
if (game.currentmenuname == Menu::language)
{
game.currentmenuoption = i;
}
}
} }
else else
{ {