mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Add confirmation popup for resetting controls to defaults
To avoid accidentally losing all binds.
This commit is contained in:
parent
a45f833afa
commit
9b719ef61c
|
@ -570,6 +570,7 @@ protected:
|
|||
void RenderSettingsDummyPlayer(CUIRect MainView);
|
||||
void RenderSettingsTee(CUIRect MainView);
|
||||
void RenderSettingsControls(CUIRect MainView);
|
||||
void ResetSettingsControls();
|
||||
void RenderSettingsGraphics(CUIRect MainView);
|
||||
void RenderSettingsSound(CUIRect MainView);
|
||||
void RenderSettings(CUIRect MainView);
|
||||
|
|
|
@ -1337,19 +1337,8 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
static CButtonContainer s_DefaultButton;
|
||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
|
||||
{
|
||||
m_pClient->m_Binds.SetDefaults();
|
||||
|
||||
g_Config.m_InpMousesens = 200;
|
||||
g_Config.m_UiMousesens = 200;
|
||||
|
||||
g_Config.m_InpControllerEnable = 0;
|
||||
g_Config.m_InpControllerGUID[0] = '\0';
|
||||
g_Config.m_InpControllerAbsolute = 0;
|
||||
g_Config.m_InpControllerSens = 100;
|
||||
g_Config.m_InpControllerX = 0;
|
||||
g_Config.m_InpControllerY = 1;
|
||||
g_Config.m_InpControllerTolerance = 5;
|
||||
g_Config.m_UiControllerSens = 100;
|
||||
PopupConfirm(Localize("Reset controls"), Localize("Are you sure that you want to reset the controls to their defaults?"),
|
||||
Localize("Reset"), Localize("Cancel"), &CMenus::ResetSettingsControls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1421,6 +1410,23 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
s_ScrollRegion.End();
|
||||
}
|
||||
|
||||
void CMenus::ResetSettingsControls()
|
||||
{
|
||||
m_pClient->m_Binds.SetDefaults();
|
||||
|
||||
g_Config.m_InpMousesens = 200;
|
||||
g_Config.m_UiMousesens = 200;
|
||||
|
||||
g_Config.m_InpControllerEnable = 0;
|
||||
g_Config.m_InpControllerGUID[0] = '\0';
|
||||
g_Config.m_InpControllerAbsolute = 0;
|
||||
g_Config.m_InpControllerSens = 100;
|
||||
g_Config.m_InpControllerX = 0;
|
||||
g_Config.m_InpControllerY = 1;
|
||||
g_Config.m_InpControllerTolerance = 5;
|
||||
g_Config.m_UiControllerSens = 100;
|
||||
}
|
||||
|
||||
int CMenus::RenderDropDown(int &CurDropDownState, CUIRect *pRect, int CurSelection, const void **pIDs, const char **pStr, int PickNum, CButtonContainer *pButtonContainer, float &ScrollVal)
|
||||
{
|
||||
if(CurDropDownState != 0)
|
||||
|
|
Loading…
Reference in a new issue