1970: Save selected UI settings page r=def- a=ChillerDragon

Inspired by @SushiTee's teeworlds commit:
65cc8f7fd9

Co-authored-by: ChillerDragon <chillerdragon@gmail.com>
This commit is contained in:
bors[bot] 2019-11-17 18:33:19 +00:00 committed by GitHub
commit f7b7c3afb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 14 deletions

View file

@ -344,7 +344,17 @@ public:
PAGE_SETTINGS,
PAGE_SYSTEM,
PAGE_NETWORK,
PAGE_GHOST
PAGE_GHOST,
SETTINGS_LANGUAGE=0,
SETTINGS_GENERAL,
SETTINGS_PLAYER,
SETTINGS_TEE,
SETTINGS_HUD,
SETTINGS_CONTROLS,
SETTINGS_GRAPHICS,
SETTINGS_SOUND,
SETTINGS_DDNET,
};
// DDRace

View file

@ -1364,8 +1364,6 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
void CMenus::RenderSettings(CUIRect MainView)
{
static int s_SettingsPage = 0;
// render background
CUIRect Temp, TabBar, RestartWarning;
MainView.VSplitRight(120.0f, &MainView, &TabBar);
@ -1397,29 +1395,29 @@ void CMenus::RenderSettings(CUIRect MainView)
{
TabBar.HSplitTop(10, &Button, &TabBar);
TabBar.HSplitTop(26, &Button, &TabBar);
if(DoButton_MenuTab(aTabs[i], aTabs[i], s_SettingsPage == i, &Button, CUI::CORNER_R))
s_SettingsPage = i;
if(DoButton_MenuTab(aTabs[i], aTabs[i], g_Config.m_UiSettingsPage == i, &Button, CUI::CORNER_R))
g_Config.m_UiSettingsPage = i;
}
MainView.Margin(10.0f, &MainView);
if(s_SettingsPage == 0)
if(g_Config.m_UiSettingsPage == SETTINGS_LANGUAGE)
RenderLanguageSelection(MainView);
else if(s_SettingsPage == 1)
else if(g_Config.m_UiSettingsPage == SETTINGS_GENERAL)
RenderSettingsGeneral(MainView);
else if(s_SettingsPage == 2)
else if(g_Config.m_UiSettingsPage == SETTINGS_PLAYER)
RenderSettingsPlayer(MainView);
else if(s_SettingsPage == 3)
else if(g_Config.m_UiSettingsPage == SETTINGS_TEE)
RenderSettingsTee(MainView);
else if(s_SettingsPage == 4)
else if(g_Config.m_UiSettingsPage == SETTINGS_HUD)
RenderSettingsHUD(MainView);
else if(s_SettingsPage == 5)
else if(g_Config.m_UiSettingsPage == SETTINGS_CONTROLS)
RenderSettingsControls(MainView);
else if(s_SettingsPage == 6)
else if(g_Config.m_UiSettingsPage == SETTINGS_GRAPHICS)
RenderSettingsGraphics(MainView);
else if(s_SettingsPage == 7)
else if(g_Config.m_UiSettingsPage == SETTINGS_SOUND)
RenderSettingsSound(MainView);
else if(s_SettingsPage == 8)
else if(g_Config.m_UiSettingsPage == SETTINGS_DDNET)
RenderSettingsDDNet(MainView);
if(m_NeedRestartUpdate)

View file

@ -89,6 +89,7 @@ MACRO_CONFIG_STR(ClSkinPrefix, cl_skin_prefix, 100, "", CFGFLAG_CLIENT|CFGFLAG_S
MACRO_CONFIG_INT(ClFatSkins, cl_fat_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable fat skins")
MACRO_CONFIG_INT(UiPage, ui_page, 9, 0, 12, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page")
MACRO_CONFIG_INT(UiSettingsPage, ui_settings_page, 0, 0, 8, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface settings page")
MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page")
MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")
MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale")