mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39: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:
parent
c173dec8f9
commit
531b151d12
1 changed files with 13 additions and 2 deletions
|
@ -187,8 +187,7 @@ void KeyPoll::Poll(void)
|
|||
{
|
||||
if (keymap[SDLK_LCTRL])
|
||||
{
|
||||
/* Debug keybind to cycle language.
|
||||
* Not really meant to be used inside menus. */
|
||||
/* Debug keybind to cycle language. */
|
||||
int i = loc::languagelist_curlang;
|
||||
if (keymap[SDLK_LSHIFT])
|
||||
{
|
||||
|
@ -211,6 +210,18 @@ void KeyPoll::Poll(void)
|
|||
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue