mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add button to reload entities background, improve DDNet menu layout
Add a button to manually reload the entities background map instead of automatically reloading it when it's changed. As the background map was only reloaded every 10 seconds, sometimes changing the background map quickly had no effect. Improve the layout of the DDNet settings menu. Align labels and UI elements and reduce unused empty space.
This commit is contained in:
parent
7c1a667486
commit
6633e9af1d
|
@ -20,7 +20,6 @@ CBackground::CBackground(int MapType, bool OnlineOnly) :
|
||||||
m_pBackgroundImages = m_pImages;
|
m_pBackgroundImages = m_pImages;
|
||||||
m_Loaded = false;
|
m_Loaded = false;
|
||||||
m_aMapName[0] = '\0';
|
m_aMapName[0] = '\0';
|
||||||
m_LastLoad = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CBackground::~CBackground()
|
CBackground::~CBackground()
|
||||||
|
@ -47,9 +46,6 @@ void CBackground::OnInit()
|
||||||
|
|
||||||
void CBackground::LoadBackground()
|
void CBackground::LoadBackground()
|
||||||
{
|
{
|
||||||
if(time_get() - m_LastLoad < 10 * time_freq())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(m_Loaded && m_pMap == m_pBackgroundMap)
|
if(m_Loaded && m_pMap == m_pBackgroundMap)
|
||||||
m_pMap->Unload();
|
m_pMap->Unload();
|
||||||
|
|
||||||
|
@ -58,53 +54,49 @@ void CBackground::LoadBackground()
|
||||||
m_pLayers = m_pBackgroundLayers;
|
m_pLayers = m_pBackgroundLayers;
|
||||||
m_pImages = m_pBackgroundImages;
|
m_pImages = m_pBackgroundImages;
|
||||||
|
|
||||||
bool NeedImageLoading = false;
|
|
||||||
|
|
||||||
str_copy(m_aMapName, g_Config.m_ClBackgroundEntities);
|
str_copy(m_aMapName, g_Config.m_ClBackgroundEntities);
|
||||||
char aBuf[128];
|
if(g_Config.m_ClBackgroundEntities[0] != '\0')
|
||||||
str_format(aBuf, sizeof(aBuf), "maps/%s", g_Config.m_ClBackgroundEntities);
|
|
||||||
if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0)
|
|
||||||
{
|
{
|
||||||
m_pMap = Kernel()->RequestInterface<IEngineMap>();
|
bool NeedImageLoading = false;
|
||||||
if(m_pMap->IsLoaded())
|
|
||||||
|
char aBuf[IO_MAX_PATH_LENGTH];
|
||||||
|
str_format(aBuf, sizeof(aBuf), "maps/%s", g_Config.m_ClBackgroundEntities);
|
||||||
|
if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0)
|
||||||
{
|
{
|
||||||
m_pLayers = GameClient()->Layers();
|
m_pMap = Kernel()->RequestInterface<IEngineMap>();
|
||||||
m_pImages = &GameClient()->m_MapImages;
|
if(m_pMap->IsLoaded())
|
||||||
|
{
|
||||||
|
m_pLayers = GameClient()->Layers();
|
||||||
|
m_pImages = &GameClient()->m_MapImages;
|
||||||
|
m_Loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_pMap->Load(aBuf))
|
||||||
|
{
|
||||||
|
m_pLayers->InitBackground(m_pMap);
|
||||||
|
NeedImageLoading = true;
|
||||||
m_Loaded = true;
|
m_Loaded = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if(m_pMap->Load(aBuf))
|
|
||||||
{
|
|
||||||
m_pLayers->InitBackground(m_pMap);
|
|
||||||
NeedImageLoading = true;
|
|
||||||
m_Loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_Loaded)
|
if(m_Loaded)
|
||||||
{
|
{
|
||||||
CMapLayers::OnMapLoad();
|
CMapLayers::OnMapLoad();
|
||||||
if(NeedImageLoading)
|
if(NeedImageLoading)
|
||||||
m_pImages->LoadBackground(m_pLayers, m_pMap);
|
m_pImages->LoadBackground(m_pLayers, m_pMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastLoad = time_get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBackground::OnMapLoad()
|
void CBackground::OnMapLoad()
|
||||||
{
|
{
|
||||||
if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0 || str_comp(g_Config.m_ClBackgroundEntities, m_aMapName))
|
if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0 || str_comp(g_Config.m_ClBackgroundEntities, m_aMapName))
|
||||||
{
|
{
|
||||||
m_LastLoad = 0;
|
|
||||||
LoadBackground();
|
LoadBackground();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBackground::OnRender()
|
void CBackground::OnRender()
|
||||||
{
|
{
|
||||||
//probably not the best place for this
|
|
||||||
if(g_Config.m_ClBackgroundEntities[0] != '\0' && str_comp(g_Config.m_ClBackgroundEntities, m_aMapName))
|
|
||||||
LoadBackground();
|
|
||||||
|
|
||||||
if(!m_Loaded)
|
if(!m_Loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,6 @@ protected:
|
||||||
bool m_Loaded;
|
bool m_Loaded;
|
||||||
char m_aMapName[MAX_MAP_LENGTH];
|
char m_aMapName[MAX_MAP_LENGTH];
|
||||||
|
|
||||||
//to avoid spam when in menu
|
|
||||||
int64_t m_LastLoad;
|
|
||||||
|
|
||||||
//to avoid memory leak when switching to %current%
|
//to avoid memory leak when switching to %current%
|
||||||
CBackgroundEngineMap *m_pBackgroundMap;
|
CBackgroundEngineMap *m_pBackgroundMap;
|
||||||
CLayers *m_pBackgroundLayers;
|
CLayers *m_pBackgroundLayers;
|
||||||
|
@ -45,6 +42,7 @@ public:
|
||||||
virtual void OnRender() override;
|
virtual void OnRender() override;
|
||||||
|
|
||||||
void LoadBackground();
|
void LoadBackground();
|
||||||
|
const char *MapName() const { return m_aMapName; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -307,8 +307,6 @@ void CMenuBackground::LoadMenuBackground(bool HasDayHint, bool HasNightHint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastLoad = time_get();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ ColorHSLA CMenus::DoLine_ColorPicker(CButtonContainer *pResetID, const float Lin
|
||||||
Section.VSplitLeft(5.0f, nullptr, &Section);
|
Section.VSplitLeft(5.0f, nullptr, &Section);
|
||||||
}
|
}
|
||||||
|
|
||||||
Section.VSplitMid(&Label, &Section, Section.h);
|
Section.VSplitMid(&Label, &Section, 4.0f);
|
||||||
Section.VSplitRight(60.0f, &Section, &ResetButton);
|
Section.VSplitRight(60.0f, &Section, &ResetButton);
|
||||||
Section.VSplitRight(8.0f, &Section, nullptr);
|
Section.VSplitRight(8.0f, &Section, nullptr);
|
||||||
Section.VSplitRight(Section.h, &Section, &ColorPickerButton);
|
Section.VSplitRight(Section.h, &Section, &ColorPickerButton);
|
||||||
|
@ -386,7 +386,7 @@ ColorHSLA CMenus::DoLine_ColorPicker(CButtonContainer *pResetID, const float Lin
|
||||||
ColorHSLA PickedColor = DoButton_ColorPicker(&ColorPickerButton, pColorValue, Alpha);
|
ColorHSLA PickedColor = DoButton_ColorPicker(&ColorPickerButton, pColorValue, Alpha);
|
||||||
|
|
||||||
ResetButton.HMargin(2.0f, &ResetButton);
|
ResetButton.HMargin(2.0f, &ResetButton);
|
||||||
if(DoButton_Menu(pResetID, Localize("Reset"), 0, &ResetButton, nullptr, IGraphics::CORNER_ALL, 8.0f, 0.0f, vec4(1, 1, 1, 0.5f), vec4(1, 1, 1, 0.25f)))
|
if(DoButton_Menu(pResetID, Localize("Reset"), 0, &ResetButton, nullptr, IGraphics::CORNER_ALL, 4.0f, 0.1f, vec4(1, 1, 1, 0.5f), vec4(1, 1, 1, 0.25f)))
|
||||||
{
|
{
|
||||||
*pColorValue = color_cast<ColorHSLA>(DefaultColor).Pack(Alpha);
|
*pColorValue = color_cast<ColorHSLA>(DefaultColor).Pack(Alpha);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2022,6 +2022,7 @@ void CMenus::RenderSettings(CUIRect MainView)
|
||||||
}
|
}
|
||||||
|
|
||||||
MainView.Margin(10.0f, &MainView);
|
MainView.Margin(10.0f, &MainView);
|
||||||
|
RestartWarning.VMargin(10.0f, &RestartWarning);
|
||||||
|
|
||||||
if(g_Config.m_UiSettingsPage == SETTINGS_LANGUAGE)
|
if(g_Config.m_UiSettingsPage == SETTINGS_LANGUAGE)
|
||||||
{
|
{
|
||||||
|
@ -2949,16 +2950,21 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
||||||
|
|
||||||
void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
{
|
{
|
||||||
CUIRect Button, Left, Right, LeftLeft, Demo, Gameplay, Miscellaneous, Label, Background;
|
CUIRect Button, Left, Right, LeftLeft, Label;
|
||||||
|
|
||||||
MainView.HSplitTop(100.0f, &Demo, &MainView);
|
#if defined(CONF_AUTOUPDATE)
|
||||||
|
CUIRect UpdaterRect;
|
||||||
|
MainView.HSplitBottom(20.0f, &MainView, &UpdaterRect);
|
||||||
|
MainView.HSplitBottom(5.0f, &MainView, nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// demo
|
||||||
|
CUIRect Demo;
|
||||||
|
MainView.HSplitTop(110.0f, &Demo, &MainView);
|
||||||
Demo.HSplitTop(30.0f, &Label, &Demo);
|
Demo.HSplitTop(30.0f, &Label, &Demo);
|
||||||
UI()->DoLabel(&Label, Localize("Demo"), 20.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&Label, Localize("Demo"), 20.0f, TEXTALIGN_ML);
|
||||||
Demo.Margin(5.0f, &Demo);
|
Demo.HSplitTop(5.0f, nullptr, &Demo);
|
||||||
Demo.VSplitMid(&Left, &Right);
|
Demo.VSplitMid(&Left, &Right, 20.0f);
|
||||||
Left.VSplitRight(5.0f, &Left, 0);
|
|
||||||
Right.VMargin(5.0f, &Right);
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClAutoRaceRecord, Localize("Save the best demo of each race"), g_Config.m_ClAutoRaceRecord, &Button))
|
if(DoButton_CheckBox(&g_Config.m_ClAutoRaceRecord, Localize("Save the best demo of each race"), g_Config.m_ClAutoRaceRecord, &Button))
|
||||||
|
@ -2966,29 +2972,26 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
g_Config.m_ClAutoRaceRecord ^= 1;
|
g_Config.m_ClAutoRaceRecord ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
|
if(DoButton_CheckBox(&g_Config.m_ClReplays, Localize("Enable replays"), g_Config.m_ClReplays, &Button))
|
||||||
{
|
{
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
g_Config.m_ClReplays ^= 1;
|
||||||
|
if(!g_Config.m_ClReplays)
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClReplays, Localize("Enable replays"), g_Config.m_ClReplays, &Button))
|
|
||||||
{
|
{
|
||||||
g_Config.m_ClReplays ^= 1;
|
// stop recording and remove the tmp demo file
|
||||||
if(!g_Config.m_ClReplays)
|
Client()->DemoRecorder_Stop(RECORDER_REPLAYS, true);
|
||||||
{
|
}
|
||||||
// stop recording and remove the tmp demo file
|
else
|
||||||
Client()->DemoRecorder_Stop(RECORDER_REPLAYS, true);
|
{
|
||||||
}
|
// start recording
|
||||||
else
|
Client()->DemoRecorder_HandleAutoStart();
|
||||||
{
|
|
||||||
// start recording
|
|
||||||
Client()->DemoRecorder_HandleAutoStart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
|
||||||
if(g_Config.m_ClReplays)
|
|
||||||
UI()->DoScrollbarOption(&g_Config.m_ClReplayLength, &g_Config.m_ClReplayLength, &Button, Localize("Default length"), 10, 600, &CUI::ms_LinearScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
|
if(g_Config.m_ClReplays)
|
||||||
|
UI()->DoScrollbarOption(&g_Config.m_ClReplayLength, &g_Config.m_ClReplayLength, &Button, Localize("Default length"), 10, 600, &CUI::ms_LinearScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
||||||
|
|
||||||
Right.HSplitTop(20.0f, &Button, &Right);
|
Right.HSplitTop(20.0f, &Button, &Right);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClRaceGhost, Localize("Ghost"), g_Config.m_ClRaceGhost, &Button))
|
if(DoButton_CheckBox(&g_Config.m_ClRaceGhost, Localize("Ghost"), g_Config.m_ClRaceGhost, &Button))
|
||||||
{
|
{
|
||||||
|
@ -3011,42 +3014,35 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainView.HSplitTop(330.0f, &Gameplay, &MainView);
|
// gameplay
|
||||||
|
CUIRect Gameplay;
|
||||||
|
MainView.HSplitTop(150.0f, &Gameplay, &MainView);
|
||||||
Gameplay.HSplitTop(30.0f, &Label, &Gameplay);
|
Gameplay.HSplitTop(30.0f, &Label, &Gameplay);
|
||||||
UI()->DoLabel(&Label, Localize("Gameplay"), 20.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&Label, Localize("Gameplay"), 20.0f, TEXTALIGN_ML);
|
||||||
Gameplay.Margin(5.0f, &Gameplay);
|
Gameplay.HSplitTop(5.0f, nullptr, &Gameplay);
|
||||||
Gameplay.VSplitMid(&Left, &Right);
|
Gameplay.VSplitMid(&Left, &Right, 20.0f);
|
||||||
Left.VSplitRight(5.0f, &Left, 0);
|
|
||||||
Right.VMargin(5.0f, &Right);
|
|
||||||
|
|
||||||
{
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
UI()->DoScrollbarOption(&g_Config.m_ClOverlayEntities, &g_Config.m_ClOverlayEntities, &Button, Localize("Overlay entities"), 0, 100);
|
||||||
UI()->DoScrollbarOption(&g_Config.m_ClOverlayEntities, &g_Config.m_ClOverlayEntities, &Button, Localize("Overlay entities"), 0, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Button.VSplitMid(&LeftLeft, &Button);
|
||||||
Button.VSplitMid(&LeftLeft, &Button);
|
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClTextEntities, Localize("Show text entities"), g_Config.m_ClTextEntities, &LeftLeft))
|
if(DoButton_CheckBox(&g_Config.m_ClTextEntities, Localize("Show text entities"), g_Config.m_ClTextEntities, &LeftLeft))
|
||||||
g_Config.m_ClTextEntities ^= 1;
|
g_Config.m_ClTextEntities ^= 1;
|
||||||
|
|
||||||
if(g_Config.m_ClTextEntities)
|
if(g_Config.m_ClTextEntities)
|
||||||
UI()->DoScrollbarOption(&g_Config.m_ClTextEntitiesSize, &g_Config.m_ClTextEntitiesSize, &Button, Localize("Size"), 0, 100);
|
UI()->DoScrollbarOption(&g_Config.m_ClTextEntitiesSize, &g_Config.m_ClTextEntitiesSize, &Button, Localize("Size"), 0, 100);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Button.VSplitMid(&LeftLeft, &Button);
|
||||||
Button.VSplitMid(&LeftLeft, &Button);
|
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowOthers, Localize("Show others"), g_Config.m_ClShowOthers == SHOW_OTHERS_ON, &LeftLeft))
|
if(DoButton_CheckBox(&g_Config.m_ClShowOthers, Localize("Show others"), g_Config.m_ClShowOthers == SHOW_OTHERS_ON, &LeftLeft))
|
||||||
g_Config.m_ClShowOthers = g_Config.m_ClShowOthers != SHOW_OTHERS_ON ? SHOW_OTHERS_ON : SHOW_OTHERS_OFF;
|
g_Config.m_ClShowOthers = g_Config.m_ClShowOthers != SHOW_OTHERS_ON ? SHOW_OTHERS_ON : SHOW_OTHERS_OFF;
|
||||||
|
|
||||||
UI()->DoScrollbarOption(&g_Config.m_ClShowOthersAlpha, &g_Config.m_ClShowOthersAlpha, &Button, Localize("Opacity"), 0, 100);
|
UI()->DoScrollbarOption(&g_Config.m_ClShowOthersAlpha, &g_Config.m_ClShowOthersAlpha, &Button, Localize("Opacity"), 0, 100);
|
||||||
|
|
||||||
GameClient()->m_Tooltips.DoToolTip(&g_Config.m_ClShowOthersAlpha, &Button, Localize("Adjust the opacity of entities belonging to other teams, such as tees and nameplates"));
|
GameClient()->m_Tooltips.DoToolTip(&g_Config.m_ClShowOthersAlpha, &Button, Localize("Adjust the opacity of entities belonging to other teams, such as tees and nameplates"));
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Left.HSplitTop(20.0f, &Button, &Left);
|
||||||
static int s_ShowOwnTeamID = 0;
|
static int s_ShowOwnTeamID = 0;
|
||||||
|
@ -3092,42 +3088,40 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
g_Config.m_ClAntiPingGrenade ^= 1;
|
g_Config.m_ClAntiPingGrenade ^= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Right.HSplitTop(60.0f, 0, &Right);
|
|
||||||
}
|
|
||||||
|
|
||||||
Right.HSplitTop(40.0f, 0, &Right);
|
CUIRect Background, Miscellaneous;
|
||||||
|
MainView.VSplitMid(&Background, &Miscellaneous, 20.0f);
|
||||||
|
|
||||||
Left.HSplitTop(5.0f, &Button, &Left);
|
// background
|
||||||
Left.VSplitRight(10.0f, &Left, 0x0);
|
Background.HSplitTop(30.0f, &Label, &Background);
|
||||||
Right.VSplitLeft(10.0f, 0x0, &Right);
|
Background.HSplitTop(5.0f, nullptr, &Background);
|
||||||
Left.HSplitTop(25.0f, 0x0, &Left);
|
UI()->DoLabel(&Label, Localize("Background"), 20.0f, TEXTALIGN_ML);
|
||||||
CUIRect TempLabel;
|
|
||||||
Left.HSplitTop(25.0f, &TempLabel, &Left);
|
|
||||||
Left.HSplitTop(5.0f, 0x0, &Left);
|
|
||||||
|
|
||||||
UI()->DoLabel(&TempLabel, Localize("Background"), 20.0f, TEXTALIGN_ML);
|
|
||||||
|
|
||||||
Right.HSplitTop(25.0f, &TempLabel, &Right);
|
|
||||||
Right.HSplitTop(5.0f, 0x0, &Miscellaneous);
|
|
||||||
|
|
||||||
UI()->DoLabel(&TempLabel, Localize("Miscellaneous"), 20.0f, TEXTALIGN_ML);
|
|
||||||
|
|
||||||
static CButtonContainer s_ResetID2;
|
static CButtonContainer s_ResetID2;
|
||||||
ColorRGBA GreyDefault(0.5f, 0.5f, 0.5f, 1);
|
ColorRGBA GreyDefault(0.5f, 0.5f, 0.5f, 1);
|
||||||
DoLine_ColorPicker(&s_ResetID2, 25.0f, 13.0f, 5.0f, &Left, Localize("Entities Background color"), &g_Config.m_ClBackgroundEntitiesColor, GreyDefault, false);
|
DoLine_ColorPicker(&s_ResetID2, 25.0f, 13.0f, 5.0f, &Background, Localize("Entities Background color"), &g_Config.m_ClBackgroundEntitiesColor, GreyDefault, false);
|
||||||
|
|
||||||
|
CUIRect EditBox;
|
||||||
|
Background.HSplitTop(20.0f, &Label, &Background);
|
||||||
|
Background.HSplitTop(2.0f, nullptr, &Background);
|
||||||
|
Label.VSplitLeft(100.0f, &Label, &EditBox);
|
||||||
|
EditBox.VSplitRight(100.0f, &EditBox, &Button);
|
||||||
|
EditBox.VSplitRight(5.0f, &EditBox, nullptr);
|
||||||
|
|
||||||
Left.VSplitLeft(5.0f, 0x0, &Left);
|
|
||||||
Left.HSplitTop(25.0f, &Background, &Left);
|
|
||||||
Background.HSplitTop(20.0f, &Background, 0);
|
|
||||||
Background.VSplitLeft(100.0f, &Label, &TempLabel);
|
|
||||||
UI()->DoLabel(&Label, Localize("Map"), 14.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&Label, Localize("Map"), 14.0f, TEXTALIGN_ML);
|
||||||
static CLineInput s_BackgroundEntitiesInput(g_Config.m_ClBackgroundEntities, sizeof(g_Config.m_ClBackgroundEntities));
|
|
||||||
UI()->DoEditBox(&s_BackgroundEntitiesInput, &TempLabel, 14.0f);
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
static CLineInput s_BackgroundEntitiesInput(g_Config.m_ClBackgroundEntities, sizeof(g_Config.m_ClBackgroundEntities));
|
||||||
bool UseCurrentMap = str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0;
|
UI()->DoEditBox(&s_BackgroundEntitiesInput, &EditBox, 14.0f);
|
||||||
|
|
||||||
|
static CButtonContainer s_BackgroundEntitiesReloadButton;
|
||||||
|
if(DoButton_Menu(&s_BackgroundEntitiesReloadButton, Localize("Reload"), 0, &Button))
|
||||||
|
{
|
||||||
|
if(str_comp(g_Config.m_ClBackgroundEntities, m_pClient->m_BackGround.MapName()) != 0)
|
||||||
|
m_pClient->m_BackGround.LoadBackground();
|
||||||
|
}
|
||||||
|
|
||||||
|
Background.HSplitTop(20.0f, &Button, &Background);
|
||||||
|
const bool UseCurrentMap = str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0;
|
||||||
static int s_UseCurrentMapID = 0;
|
static int s_UseCurrentMapID = 0;
|
||||||
if(DoButton_CheckBox(&s_UseCurrentMapID, Localize("Use current map as background"), UseCurrentMap, &Button))
|
if(DoButton_CheckBox(&s_UseCurrentMapID, Localize("Use current map as background"), UseCurrentMap, &Button))
|
||||||
{
|
{
|
||||||
|
@ -3135,38 +3129,44 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
g_Config.m_ClBackgroundEntities[0] = '\0';
|
g_Config.m_ClBackgroundEntities[0] = '\0';
|
||||||
else
|
else
|
||||||
str_copy(g_Config.m_ClBackgroundEntities, CURRENT_MAP);
|
str_copy(g_Config.m_ClBackgroundEntities, CURRENT_MAP);
|
||||||
|
m_pClient->m_BackGround.LoadBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Background.HSplitTop(20.0f, &Button, &Background);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClBackgroundShowTilesLayers, Localize("Show tiles layers from BG map"), g_Config.m_ClBackgroundShowTilesLayers, &Button))
|
if(DoButton_CheckBox(&g_Config.m_ClBackgroundShowTilesLayers, Localize("Show tiles layers from BG map"), g_Config.m_ClBackgroundShowTilesLayers, &Button))
|
||||||
g_Config.m_ClBackgroundShowTilesLayers ^= 1;
|
g_Config.m_ClBackgroundShowTilesLayers ^= 1;
|
||||||
|
|
||||||
|
// miscellaneous
|
||||||
|
Miscellaneous.HSplitTop(30.0f, &Label, &Miscellaneous);
|
||||||
|
Miscellaneous.HSplitTop(5.0f, nullptr, &Miscellaneous);
|
||||||
|
|
||||||
|
UI()->DoLabel(&Label, Localize("Miscellaneous"), 20.0f, TEXTALIGN_ML);
|
||||||
|
|
||||||
static CButtonContainer s_ResetID1;
|
static CButtonContainer s_ResetID1;
|
||||||
Miscellaneous.HSplitTop(25.0f, &Button, &Right);
|
Miscellaneous.HSplitTop(25.0f, &Button, &Miscellaneous);
|
||||||
DoLine_ColorPicker(&s_ResetID1, 25.0f, 13.0f, 5.0f, &Button, Localize("Regular Background Color"), &g_Config.m_ClBackgroundColor, GreyDefault, false);
|
DoLine_ColorPicker(&s_ResetID1, 25.0f, 13.0f, 5.0f, &Button, Localize("Regular Background Color"), &g_Config.m_ClBackgroundColor, GreyDefault, false);
|
||||||
|
|
||||||
static CButtonContainer s_ButtonTimeout;
|
static CButtonContainer s_ButtonTimeout;
|
||||||
Right.HSplitTop(10.0f, 0x0, &Right);
|
Miscellaneous.HSplitTop(10.0f, nullptr, &Miscellaneous);
|
||||||
Right.HSplitTop(20.0f, &Button, &Right);
|
Miscellaneous.HSplitTop(20.0f, &Button, &Miscellaneous);
|
||||||
if(DoButton_Menu(&s_ButtonTimeout, Localize("New random timeout code"), 0, &Button))
|
if(DoButton_Menu(&s_ButtonTimeout, Localize("New random timeout code"), 0, &Button))
|
||||||
{
|
{
|
||||||
Client()->GenerateTimeoutSeed();
|
Client()->GenerateTimeoutSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
Right.HSplitTop(5.0f, 0, &Right);
|
Miscellaneous.HSplitTop(5.0f, nullptr, &Miscellaneous);
|
||||||
Right.HSplitTop(20.0f, &Label, &Right);
|
Miscellaneous.HSplitTop(20.0f, &Label, &Miscellaneous);
|
||||||
Label.VSplitLeft(5.0f, 0, &Label);
|
Miscellaneous.HSplitTop(2.0f, nullptr, &Miscellaneous);
|
||||||
UI()->DoLabel(&Label, Localize("Run on join"), 14.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&Label, Localize("Run on join"), 14.0f, TEXTALIGN_ML);
|
||||||
Right.HSplitTop(20.0f, &Button, &Right);
|
Miscellaneous.HSplitTop(20.0f, &Button, &Miscellaneous);
|
||||||
Button.VSplitLeft(5.0f, 0, &Button);
|
|
||||||
static CLineInput s_RunOnJoinInput(g_Config.m_ClRunOnJoin, sizeof(g_Config.m_ClRunOnJoin));
|
static CLineInput s_RunOnJoinInput(g_Config.m_ClRunOnJoin, sizeof(g_Config.m_ClRunOnJoin));
|
||||||
s_RunOnJoinInput.SetEmptyText(Localize("Chat command (e.g. showall 1)"));
|
s_RunOnJoinInput.SetEmptyText(Localize("Chat command (e.g. showall 1)"));
|
||||||
UI()->DoEditBox(&s_RunOnJoinInput, &Button, 14.0f);
|
UI()->DoEditBox(&s_RunOnJoinInput, &Button, 14.0f);
|
||||||
|
|
||||||
#if defined(CONF_FAMILY_WINDOWS)
|
#if defined(CONF_FAMILY_WINDOWS)
|
||||||
static CButtonContainer s_ButtonUnregisterShell;
|
static CButtonContainer s_ButtonUnregisterShell;
|
||||||
Right.HSplitTop(10.0f, nullptr, &Right);
|
Miscellaneous.HSplitTop(10.0f, nullptr, &Miscellaneous);
|
||||||
Right.HSplitTop(20.0f, &Button, &Right);
|
Miscellaneous.HSplitTop(20.0f, &Button, &Miscellaneous);
|
||||||
if(DoButton_Menu(&s_ButtonUnregisterShell, Localize("Unregister protocol and file extensions"), 0, &Button))
|
if(DoButton_Menu(&s_ButtonUnregisterShell, Localize("Unregister protocol and file extensions"), 0, &Button))
|
||||||
{
|
{
|
||||||
Client()->ShellUnregister();
|
Client()->ShellUnregister();
|
||||||
|
@ -3176,9 +3176,6 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
// Updater
|
// Updater
|
||||||
#if defined(CONF_AUTOUPDATE)
|
#if defined(CONF_AUTOUPDATE)
|
||||||
{
|
{
|
||||||
MainView.VSplitMid(&Left, &Right);
|
|
||||||
Left.w += 20.0f;
|
|
||||||
Left.HSplitBottom(20.0f, 0x0, &Label);
|
|
||||||
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
|
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
|
||||||
int State = Updater()->GetCurrentState();
|
int State = Updater()->GetCurrentState();
|
||||||
|
|
||||||
|
@ -3187,8 +3184,8 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
if(NeedUpdate && State <= IUpdater::CLEAN)
|
if(NeedUpdate && State <= IUpdater::CLEAN)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is available:"), Client()->LatestVersion());
|
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is available:"), Client()->LatestVersion());
|
||||||
Label.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &Label, &Button);
|
UpdaterRect.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &UpdaterRect, &Button);
|
||||||
Button.VSplitLeft(100.0f, &Button, 0);
|
Button.VSplitLeft(100.0f, &Button, nullptr);
|
||||||
static CButtonContainer s_ButtonUpdate;
|
static CButtonContainer s_ButtonUpdate;
|
||||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Update now"), 0, &Button))
|
if(DoButton_Menu(&s_ButtonUpdate, Localize("Update now"), 0, &Button))
|
||||||
{
|
{
|
||||||
|
@ -3205,15 +3202,15 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("No updates available"));
|
str_format(aBuf, sizeof(aBuf), Localize("No updates available"));
|
||||||
Label.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &Label, &Button);
|
UpdaterRect.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &UpdaterRect, &Button);
|
||||||
Button.VSplitLeft(100.0f, &Button, 0);
|
Button.VSplitLeft(100.0f, &Button, nullptr);
|
||||||
static CButtonContainer s_ButtonUpdate;
|
static CButtonContainer s_ButtonUpdate;
|
||||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Check now"), 0, &Button))
|
if(DoButton_Menu(&s_ButtonUpdate, Localize("Check now"), 0, &Button))
|
||||||
{
|
{
|
||||||
Client()->RequestDDNetInfo();
|
Client()->RequestDDNetInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_ML);
|
UI()->DoLabel(&UpdaterRect, aBuf, 14.0f, TEXTALIGN_ML);
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue