mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #6734
6734: Use `DoLabel` instead of `Text`/`TextEx` in menus, other minor refactoring of menus r=def- a=Robyt3 ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
4d0247a24c
|
@ -617,7 +617,6 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
||||||
{
|
{
|
||||||
CUIRect ServerFilter = View, FilterHeader;
|
CUIRect ServerFilter = View, FilterHeader;
|
||||||
const float FontSize = 12.0f;
|
const float FontSize = 12.0f;
|
||||||
ServerFilter.HSplitBottom(0.0f, &ServerFilter, 0);
|
|
||||||
|
|
||||||
// server filter
|
// server filter
|
||||||
ServerFilter.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFilter);
|
ServerFilter.HSplitTop(ms_ListheaderHeight, &FilterHeader, &ServerFilter);
|
||||||
|
@ -1037,7 +1036,6 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
||||||
ServerDetails.HSplitTop(110.0f, &ServerDetails, &ServerScoreBoard);
|
ServerDetails.HSplitTop(110.0f, &ServerDetails, &ServerScoreBoard);
|
||||||
|
|
||||||
// server details
|
// server details
|
||||||
CTextCursor Cursor;
|
|
||||||
const float FontSize = 12.0f;
|
const float FontSize = 12.0f;
|
||||||
ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails);
|
ServerDetails.HSplitTop(ms_ListheaderHeight, &ServerHeader, &ServerDetails);
|
||||||
ServerHeader.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_T, 4.0f);
|
ServerHeader.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_T, 4.0f);
|
||||||
|
@ -1110,25 +1108,19 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
||||||
for(auto &Label : s_aLabels)
|
for(auto &Label : s_aLabels)
|
||||||
{
|
{
|
||||||
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
|
LeftColumn.HSplitTop(15.0f, &Row, &LeftColumn);
|
||||||
UI()->DoLabel(&Row, Localize(Label), FontSize, TEXTALIGN_ML);
|
UI()->DoLabel(&Row, Label, FontSize, TEXTALIGN_ML);
|
||||||
}
|
}
|
||||||
|
|
||||||
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
||||||
TextRender()->SetCursor(&Cursor, Row.x, Row.y + (15.f - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
UI()->DoLabel(&Row, pSelectedServer->m_aVersion, FontSize, TEXTALIGN_ML);
|
||||||
Cursor.m_LineWidth = Row.w;
|
|
||||||
TextRender()->TextEx(&Cursor, pSelectedServer->m_aVersion, -1);
|
|
||||||
|
|
||||||
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
||||||
TextRender()->SetCursor(&Cursor, Row.x, Row.y + (15.f - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
UI()->DoLabel(&Row, pSelectedServer->m_aGameType, FontSize, TEXTALIGN_ML);
|
||||||
Cursor.m_LineWidth = Row.w;
|
|
||||||
TextRender()->TextEx(&Cursor, pSelectedServer->m_aGameType, -1);
|
|
||||||
|
|
||||||
char aTemp[16];
|
char aTemp[16];
|
||||||
FormatServerbrowserPing(aTemp, sizeof(aTemp), pSelectedServer);
|
FormatServerbrowserPing(aTemp, sizeof(aTemp), pSelectedServer);
|
||||||
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
RightColumn.HSplitTop(15.0f, &Row, &RightColumn);
|
||||||
TextRender()->SetCursor(&Cursor, Row.x, Row.y + (15.f - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
UI()->DoLabel(&Row, aTemp, FontSize, TEXTALIGN_ML);
|
||||||
Cursor.m_LineWidth = Row.w;
|
|
||||||
TextRender()->TextEx(&Cursor, aTemp, -1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1138,6 +1130,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
||||||
// server scoreboard
|
// server scoreboard
|
||||||
ServerScoreBoard.HSplitBottom(23.0f, &ServerScoreBoard, 0x0);
|
ServerScoreBoard.HSplitBottom(23.0f, &ServerScoreBoard, 0x0);
|
||||||
|
|
||||||
|
CTextCursor Cursor;
|
||||||
if(pSelectedServer)
|
if(pSelectedServer)
|
||||||
{
|
{
|
||||||
static CListBox s_ListBox;
|
static CListBox s_ListBox;
|
||||||
|
@ -1208,13 +1201,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float ScoreFontSize = 12.0f;
|
UI()->DoLabel(&Score, aTemp, FontSize, TEXTALIGN_ML);
|
||||||
while(ScoreFontSize >= 4.0f && TextRender()->TextWidth(ScoreFontSize, aTemp, -1, -1.0f) > Score.w)
|
|
||||||
ScoreFontSize--;
|
|
||||||
|
|
||||||
TextRender()->SetCursor(&Cursor, Score.x, Score.y + (Score.h - ScoreFontSize) / 2.0f, ScoreFontSize, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
|
||||||
Cursor.m_LineWidth = Score.w;
|
|
||||||
TextRender()->TextEx(&Cursor, aTemp, -1);
|
|
||||||
|
|
||||||
// render tee if available
|
// render tee if available
|
||||||
if(HasTeeToRender)
|
if(HasTeeToRender)
|
||||||
|
@ -1704,7 +1691,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
||||||
ToolboxPage = 0;
|
ToolboxPage = 0;
|
||||||
|
|
||||||
static CButtonContainer s_InfoTab;
|
static CButtonContainer s_InfoTab;
|
||||||
if(DoButton_MenuTab(&s_InfoTab, Localize("Info"), ToolboxPage == 1, &TabButton1, 0, NULL, NULL, NULL, NULL, 4.0f))
|
if(DoButton_MenuTab(&s_InfoTab, Localize("Info"), ToolboxPage == 1, &TabButton1, IGraphics::CORNER_NONE, NULL, NULL, NULL, NULL, 4.0f))
|
||||||
ToolboxPage = 1;
|
ToolboxPage = 1;
|
||||||
|
|
||||||
static CButtonContainer s_FriendsTab;
|
static CButtonContainer s_FriendsTab;
|
||||||
|
|
|
@ -577,10 +577,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
DemoPlayer()->GetDemoName(aDemoName, sizeof(aDemoName));
|
DemoPlayer()->GetDemoName(aDemoName, sizeof(aDemoName));
|
||||||
char aBuf[IO_MAX_PATH_LENGTH + 128];
|
char aBuf[IO_MAX_PATH_LENGTH + 128];
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Demofile: %s"), aDemoName);
|
str_format(aBuf, sizeof(aBuf), Localize("Demofile: %s"), aDemoName);
|
||||||
CTextCursor Cursor;
|
UI()->DoLabel(&NameBar, aBuf, Button.h * 0.5f, TEXTALIGN_ML);
|
||||||
TextRender()->SetCursor(&Cursor, NameBar.x, NameBar.y + (NameBar.h - (Button.h * 0.5f)) / 2.f, Button.h * 0.5f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
|
||||||
Cursor.m_LineWidth = DemoControls.w;
|
|
||||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
|
||||||
|
|
||||||
if(IncreaseDemoSpeed)
|
if(IncreaseDemoSpeed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,14 +311,9 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
||||||
Player.HSplitTop(1.5f, nullptr, &Player);
|
Player.HSplitTop(1.5f, nullptr, &Player);
|
||||||
Player.VSplitMid(&Player, &Button);
|
Player.VSplitMid(&Player, &Button);
|
||||||
Row.VSplitRight(210.0f, &Button2, &Row);
|
Row.VSplitRight(210.0f, &Button2, &Row);
|
||||||
CTextCursor Cursor;
|
|
||||||
TextRender()->SetCursor(&Cursor, Player.x, Player.y + (Player.h - 14.f) / 2.f, 14.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
|
||||||
Cursor.m_LineWidth = Player.w;
|
|
||||||
TextRender()->TextEx(&Cursor, CurrentClient.m_aName, -1);
|
|
||||||
|
|
||||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 14.f) / 2.f, 14.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
UI()->DoLabel(&Player, CurrentClient.m_aName, 14.0f, TEXTALIGN_ML);
|
||||||
Cursor.m_LineWidth = Button.w;
|
UI()->DoLabel(&Button, CurrentClient.m_aClan, 14.0f, TEXTALIGN_ML);
|
||||||
TextRender()->TextEx(&Cursor, CurrentClient.m_aClan, -1);
|
|
||||||
|
|
||||||
m_pClient->m_CountryFlags.Render(CurrentClient.m_Country, ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f),
|
m_pClient->m_CountryFlags.Render(CurrentClient.m_Country, ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f),
|
||||||
Button2.x, Button2.y + Button2.h / 2.0f - 0.75f * Button2.h / 2.0f, 1.5f * Button2.h, 0.75f * Button2.h);
|
Button2.x, Button2.y + Button2.h / 2.0f - 0.75f * Button2.h / 2.0f, 1.5f * Button2.h, 0.75f * Button2.h);
|
||||||
|
@ -1075,21 +1070,13 @@ void CMenus::RenderGhost(CUIRect MainView)
|
||||||
}
|
}
|
||||||
else if(Id == COL_NAME)
|
else if(Id == COL_NAME)
|
||||||
{
|
{
|
||||||
CTextCursor Cursor;
|
UI()->DoLabel(&Button, pGhost->m_aPlayer, 12.0f, TEXTALIGN_ML);
|
||||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f) / 2.f, 12.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
|
||||||
Cursor.m_LineWidth = Button.w;
|
|
||||||
|
|
||||||
TextRender()->TextEx(&Cursor, pGhost->m_aPlayer, -1);
|
|
||||||
}
|
}
|
||||||
else if(Id == COL_TIME)
|
else if(Id == COL_TIME)
|
||||||
{
|
{
|
||||||
CTextCursor Cursor;
|
|
||||||
TextRender()->SetCursor(&Cursor, Button.x, Button.y + (Button.h - 12.0f) / 2.f, 12.0f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
|
|
||||||
Cursor.m_LineWidth = Button.w;
|
|
||||||
|
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
str_time(pGhost->m_Time / 10, TIME_HOURS_CENTISECS, aBuf, sizeof(aBuf));
|
str_time(pGhost->m_Time / 10, TIME_HOURS_CENTISECS, aBuf, sizeof(aBuf));
|
||||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
UI()->DoLabel(&Button, aBuf, 12.0f, TEXTALIGN_ML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1289,7 +1289,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
const float Margin = 10.0f;
|
const float Margin = 10.0f;
|
||||||
const float HeaderHeight = FontSize + 5.0f + Margin;
|
const float HeaderHeight = FontSize + 5.0f + Margin;
|
||||||
|
|
||||||
CUIRect MouseSettings, MovementSettings, WeaponSettings, VotingSettings, ChatSettings, DummySettings, MiscSettings, JoystickSettings, ResetButton;
|
CUIRect MouseSettings, MovementSettings, WeaponSettings, VotingSettings, ChatSettings, DummySettings, MiscSettings, JoystickSettings, ResetButton, Button;
|
||||||
MainView.VSplitMid(&MouseSettings, &VotingSettings);
|
MainView.VSplitMid(&MouseSettings, &VotingSettings);
|
||||||
|
|
||||||
// mouse settings
|
// mouse settings
|
||||||
|
@ -1301,15 +1301,13 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
MouseSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
MouseSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
MouseSettings.VMargin(10.0f, &MouseSettings);
|
MouseSettings.VMargin(10.0f, &MouseSettings);
|
||||||
|
|
||||||
TextRender()->Text(MouseSettings.x, MouseSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Mouse"), -1.0f);
|
MouseSettings.HSplitTop(HeaderHeight, &Button, &MouseSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Mouse"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
MouseSettings.HSplitTop(HeaderHeight, 0, &MouseSettings);
|
|
||||||
|
|
||||||
CUIRect Button;
|
|
||||||
MouseSettings.HSplitTop(20.0f, &Button, &MouseSettings);
|
MouseSettings.HSplitTop(20.0f, &Button, &MouseSettings);
|
||||||
UI()->DoScrollbarOption(&g_Config.m_InpMousesens, &g_Config.m_InpMousesens, &Button, Localize("Ingame mouse sens."), 1, 500, &CUI::ms_LogarithmicScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
UI()->DoScrollbarOption(&g_Config.m_InpMousesens, &g_Config.m_InpMousesens, &Button, Localize("Ingame mouse sens."), 1, 500, &CUI::ms_LogarithmicScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
||||||
|
|
||||||
MouseSettings.HSplitTop(2.0f, 0, &MouseSettings);
|
MouseSettings.HSplitTop(2.0f, nullptr, &MouseSettings);
|
||||||
|
|
||||||
MouseSettings.HSplitTop(20.0f, &Button, &MouseSettings);
|
MouseSettings.HSplitTop(20.0f, &Button, &MouseSettings);
|
||||||
UI()->DoScrollbarOption(&g_Config.m_UiMousesens, &g_Config.m_UiMousesens, &Button, Localize("UI mouse sens."), 1, 500, &CUI::ms_LogarithmicScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
UI()->DoScrollbarOption(&g_Config.m_UiMousesens, &g_Config.m_UiMousesens, &Button, Localize("UI mouse sens."), 1, 500, &CUI::ms_LogarithmicScrollbarScale, CUI::SCROLLBAR_OPTION_NOCLAMPVALUE);
|
||||||
|
@ -1318,61 +1316,60 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
|
|
||||||
// joystick settings
|
// joystick settings
|
||||||
{
|
{
|
||||||
JoystickSettings.HSplitTop(Margin, 0, &JoystickSettings);
|
JoystickSettings.HSplitTop(Margin, nullptr, &JoystickSettings);
|
||||||
JoystickSettings.HSplitTop(s_JoystickSettingsHeight + HeaderHeight + Margin, &JoystickSettings, &MovementSettings);
|
JoystickSettings.HSplitTop(s_JoystickSettingsHeight + HeaderHeight + Margin, &JoystickSettings, &MovementSettings);
|
||||||
if(s_ScrollRegion.AddRect(JoystickSettings))
|
if(s_ScrollRegion.AddRect(JoystickSettings))
|
||||||
{
|
{
|
||||||
JoystickSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
JoystickSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
JoystickSettings.VMargin(Margin, &JoystickSettings);
|
JoystickSettings.VMargin(Margin, &JoystickSettings);
|
||||||
|
|
||||||
TextRender()->Text(JoystickSettings.x, JoystickSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Controller"), -1.0f);
|
JoystickSettings.HSplitTop(HeaderHeight, &Button, &JoystickSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Controller"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
JoystickSettings.HSplitTop(HeaderHeight, 0, &JoystickSettings);
|
|
||||||
s_JoystickSettingsHeight = RenderSettingsControlsJoystick(JoystickSettings);
|
s_JoystickSettingsHeight = RenderSettingsControlsJoystick(JoystickSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// movement settings
|
// movement settings
|
||||||
{
|
{
|
||||||
MovementSettings.HSplitTop(Margin, 0, &MovementSettings);
|
MovementSettings.HSplitTop(Margin, nullptr, &MovementSettings);
|
||||||
MovementSettings.HSplitTop(365.0f, &MovementSettings, &WeaponSettings);
|
MovementSettings.HSplitTop(365.0f, &MovementSettings, &WeaponSettings);
|
||||||
if(s_ScrollRegion.AddRect(MovementSettings))
|
if(s_ScrollRegion.AddRect(MovementSettings))
|
||||||
{
|
{
|
||||||
MovementSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
MovementSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
MovementSettings.VMargin(Margin, &MovementSettings);
|
MovementSettings.VMargin(Margin, &MovementSettings);
|
||||||
|
|
||||||
TextRender()->Text(MovementSettings.x, MovementSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Movement"), -1.0f);
|
MovementSettings.HSplitTop(HeaderHeight, &Button, &MovementSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Movement"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
MovementSettings.HSplitTop(HeaderHeight, 0, &MovementSettings);
|
|
||||||
DoSettingsControlsButtons(0, 15, MovementSettings);
|
DoSettingsControlsButtons(0, 15, MovementSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// weapon settings
|
// weapon settings
|
||||||
{
|
{
|
||||||
WeaponSettings.HSplitTop(Margin, 0, &WeaponSettings);
|
WeaponSettings.HSplitTop(Margin, nullptr, &WeaponSettings);
|
||||||
WeaponSettings.HSplitTop(190.0f, &WeaponSettings, &ResetButton);
|
WeaponSettings.HSplitTop(190.0f, &WeaponSettings, &ResetButton);
|
||||||
if(s_ScrollRegion.AddRect(WeaponSettings))
|
if(s_ScrollRegion.AddRect(WeaponSettings))
|
||||||
{
|
{
|
||||||
WeaponSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
WeaponSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
WeaponSettings.VMargin(Margin, &WeaponSettings);
|
WeaponSettings.VMargin(Margin, &WeaponSettings);
|
||||||
|
|
||||||
TextRender()->Text(WeaponSettings.x, WeaponSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Weapon"), -1.0f);
|
WeaponSettings.HSplitTop(HeaderHeight, &Button, &WeaponSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Weapon"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
WeaponSettings.HSplitTop(HeaderHeight, 0, &WeaponSettings);
|
|
||||||
DoSettingsControlsButtons(15, 22, WeaponSettings);
|
DoSettingsControlsButtons(15, 22, WeaponSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
{
|
{
|
||||||
ResetButton.HSplitTop(Margin, 0, &ResetButton);
|
ResetButton.HSplitTop(Margin, nullptr, &ResetButton);
|
||||||
ResetButton.HSplitTop(40.0f, &ResetButton, 0);
|
ResetButton.HSplitTop(40.0f, &ResetButton, nullptr);
|
||||||
if(s_ScrollRegion.AddRect(ResetButton))
|
if(s_ScrollRegion.AddRect(ResetButton))
|
||||||
{
|
{
|
||||||
ResetButton.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
ResetButton.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
ResetButton.HMargin(10.0f, &ResetButton);
|
ResetButton.Margin(10.0f, &ResetButton);
|
||||||
ResetButton.VMargin(30.0f, &ResetButton);
|
|
||||||
static CButtonContainer s_DefaultButton;
|
static CButtonContainer s_DefaultButton;
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
|
if(DoButton_Menu(&s_DefaultButton, Localize("Reset to defaults"), 0, &ResetButton))
|
||||||
{
|
{
|
||||||
|
@ -1391,57 +1388,57 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
||||||
VotingSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
VotingSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
VotingSettings.VMargin(Margin, &VotingSettings);
|
VotingSettings.VMargin(Margin, &VotingSettings);
|
||||||
|
|
||||||
TextRender()->Text(VotingSettings.x, VotingSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Voting"), -1.0f);
|
VotingSettings.HSplitTop(HeaderHeight, &Button, &VotingSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Voting"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
VotingSettings.HSplitTop(HeaderHeight, 0, &VotingSettings);
|
|
||||||
DoSettingsControlsButtons(22, 24, VotingSettings);
|
DoSettingsControlsButtons(22, 24, VotingSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chat settings
|
// chat settings
|
||||||
{
|
{
|
||||||
ChatSettings.HSplitTop(Margin, 0, &ChatSettings);
|
ChatSettings.HSplitTop(Margin, nullptr, &ChatSettings);
|
||||||
ChatSettings.HSplitTop(145.0f, &ChatSettings, &DummySettings);
|
ChatSettings.HSplitTop(145.0f, &ChatSettings, &DummySettings);
|
||||||
if(s_ScrollRegion.AddRect(ChatSettings))
|
if(s_ScrollRegion.AddRect(ChatSettings))
|
||||||
{
|
{
|
||||||
ChatSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
ChatSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
ChatSettings.VMargin(Margin, &ChatSettings);
|
ChatSettings.VMargin(Margin, &ChatSettings);
|
||||||
|
|
||||||
TextRender()->Text(ChatSettings.x, ChatSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Chat"), -1.0f);
|
ChatSettings.HSplitTop(HeaderHeight, &Button, &ChatSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Chat"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
ChatSettings.HSplitTop(HeaderHeight, 0, &ChatSettings);
|
|
||||||
DoSettingsControlsButtons(24, 29, ChatSettings);
|
DoSettingsControlsButtons(24, 29, ChatSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dummy settings
|
// dummy settings
|
||||||
{
|
{
|
||||||
DummySettings.HSplitTop(Margin, 0, &DummySettings);
|
DummySettings.HSplitTop(Margin, nullptr, &DummySettings);
|
||||||
DummySettings.HSplitTop(100.0f, &DummySettings, &MiscSettings);
|
DummySettings.HSplitTop(100.0f, &DummySettings, &MiscSettings);
|
||||||
if(s_ScrollRegion.AddRect(DummySettings))
|
if(s_ScrollRegion.AddRect(DummySettings))
|
||||||
{
|
{
|
||||||
DummySettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
DummySettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
DummySettings.VMargin(Margin, &DummySettings);
|
DummySettings.VMargin(Margin, &DummySettings);
|
||||||
|
|
||||||
TextRender()->Text(DummySettings.x, DummySettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Dummy"), -1.0f);
|
DummySettings.HSplitTop(HeaderHeight, &Button, &DummySettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Dummy"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
DummySettings.HSplitTop(HeaderHeight, 0, &DummySettings);
|
|
||||||
DoSettingsControlsButtons(29, 32, DummySettings);
|
DoSettingsControlsButtons(29, 32, DummySettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// misc settings
|
// misc settings
|
||||||
{
|
{
|
||||||
MiscSettings.HSplitTop(Margin, 0, &MiscSettings);
|
MiscSettings.HSplitTop(Margin, nullptr, &MiscSettings);
|
||||||
MiscSettings.HSplitTop(300.0f, &MiscSettings, 0);
|
MiscSettings.HSplitTop(300.0f, &MiscSettings, 0);
|
||||||
if(s_ScrollRegion.AddRect(MiscSettings))
|
if(s_ScrollRegion.AddRect(MiscSettings))
|
||||||
{
|
{
|
||||||
MiscSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
MiscSettings.Draw(ColorRGBA(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 10.0f);
|
||||||
MiscSettings.VMargin(Margin, &MiscSettings);
|
MiscSettings.VMargin(Margin, &MiscSettings);
|
||||||
|
|
||||||
TextRender()->Text(MiscSettings.x, MiscSettings.y + (HeaderHeight - FontSize) / 2.f, FontSize, Localize("Miscellaneous"), -1.0f);
|
MiscSettings.HSplitTop(HeaderHeight, &Button, &MiscSettings);
|
||||||
|
UI()->DoLabel(&Button, Localize("Miscellaneous"), FontSize, TEXTALIGN_ML);
|
||||||
|
|
||||||
MiscSettings.HSplitTop(HeaderHeight, 0, &MiscSettings);
|
|
||||||
DoSettingsControlsButtons(32, 44, MiscSettings);
|
DoSettingsControlsButtons(32, 44, MiscSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2006,37 +2003,33 @@ bool CMenus::RenderLanguageSelection(CUIRect MainView)
|
||||||
void CMenus::RenderSettings(CUIRect MainView)
|
void CMenus::RenderSettings(CUIRect MainView)
|
||||||
{
|
{
|
||||||
// render background
|
// render background
|
||||||
CUIRect Temp, TabBar, RestartWarning;
|
CUIRect Button, TabBar, RestartWarning;
|
||||||
MainView.VSplitRight(120.0f, &MainView, &TabBar);
|
MainView.VSplitRight(120.0f, &MainView, &TabBar);
|
||||||
MainView.Draw(ms_ColorTabbarActive, IGraphics::CORNER_B, 10.0f);
|
MainView.Draw(ms_ColorTabbarActive, IGraphics::CORNER_B, 10.0f);
|
||||||
MainView.Margin(10.0f, &MainView);
|
MainView.Margin(10.0f, &MainView);
|
||||||
MainView.HSplitBottom(15.0f, &MainView, &RestartWarning);
|
MainView.HSplitBottom(15.0f, &MainView, &RestartWarning);
|
||||||
TabBar.HSplitTop(50.0f, &Temp, &TabBar);
|
TabBar.HSplitTop(50.0f, &Button, &TabBar);
|
||||||
Temp.Draw(ms_ColorTabbarActive, IGraphics::CORNER_BR, 10.0f);
|
Button.Draw(ms_ColorTabbarActive, IGraphics::CORNER_BR, 10.0f);
|
||||||
|
|
||||||
MainView.HSplitTop(10.0f, 0, &MainView);
|
MainView.HSplitTop(10.0f, nullptr, &MainView);
|
||||||
|
|
||||||
CUIRect Button;
|
const char *apTabs[SETTINGS_LENGTH] = {
|
||||||
|
|
||||||
const char *apTabs[] = {
|
|
||||||
Localize("Language"),
|
Localize("Language"),
|
||||||
Localize("General"),
|
Localize("General"),
|
||||||
Localize("Player"),
|
Localize("Player"),
|
||||||
("Tee"),
|
"Tee",
|
||||||
Localize("Appearance"),
|
Localize("Appearance"),
|
||||||
Localize("Controls"),
|
Localize("Controls"),
|
||||||
Localize("Graphics"),
|
Localize("Graphics"),
|
||||||
Localize("Sound"),
|
Localize("Sound"),
|
||||||
Localize("DDNet"),
|
Localize("DDNet"),
|
||||||
Localize("Assets")};
|
Localize("Assets")};
|
||||||
static CButtonContainer s_aTabButtons[sizeof(apTabs)];
|
static CButtonContainer s_aTabButtons[SETTINGS_LENGTH];
|
||||||
|
|
||||||
int NumTabs = (int)std::size(apTabs);
|
for(int i = 0; i < SETTINGS_LENGTH; i++)
|
||||||
|
|
||||||
for(int i = 0; i < NumTabs; i++)
|
|
||||||
{
|
{
|
||||||
TabBar.HSplitTop(10, &Button, &TabBar);
|
TabBar.HSplitTop(10.0f, nullptr, &TabBar);
|
||||||
TabBar.HSplitTop(26, &Button, &TabBar);
|
TabBar.HSplitTop(26.0f, &Button, &TabBar);
|
||||||
if(DoButton_MenuTab(&s_aTabButtons[i], apTabs[i], g_Config.m_UiSettingsPage == i, &Button, IGraphics::CORNER_R, &m_aAnimatorsSettingsTab[i]))
|
if(DoButton_MenuTab(&s_aTabButtons[i], apTabs[i], g_Config.m_UiSettingsPage == i, &Button, IGraphics::CORNER_R, &m_aAnimatorsSettingsTab[i]))
|
||||||
g_Config.m_UiSettingsPage = i;
|
g_Config.m_UiSettingsPage = i;
|
||||||
}
|
}
|
||||||
|
@ -2484,14 +2477,14 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
||||||
if(DoButton_MenuTab(&s_aPageTabs[APPEARANCE_TAB_LASER], Localize("Laser"), s_CurTab == APPEARANCE_TAB_LASER, &Page6Tab, IGraphics::CORNER_R, NULL, NULL, NULL, NULL, 4))
|
if(DoButton_MenuTab(&s_aPageTabs[APPEARANCE_TAB_LASER], Localize("Laser"), s_CurTab == APPEARANCE_TAB_LASER, &Page6Tab, IGraphics::CORNER_R, NULL, NULL, NULL, NULL, 4))
|
||||||
s_CurTab = APPEARANCE_TAB_LASER;
|
s_CurTab = APPEARANCE_TAB_LASER;
|
||||||
|
|
||||||
MainView.HSplitTop(10.0f, 0x0, &MainView); // Margin
|
MainView.HSplitTop(10.0f, nullptr, &MainView);
|
||||||
|
|
||||||
const float LineSize = 20.0f;
|
const float LineSize = 20.0f;
|
||||||
const float ColorPickerLineSize = 25.0f;
|
const float ColorPickerLineSize = 25.0f;
|
||||||
const float SectionMargin = 5.0f;
|
const float SectionMargin = 5.0f;
|
||||||
const float SectionTotalMargin = 10.0f; // SectionMargin * 2;
|
const float SectionTotalMargin = SectionMargin * 2;
|
||||||
const float HeadlineFontSize = 20.0f;
|
const float HeadlineFontSize = 20.0f;
|
||||||
const float HeadlineAndVMargin = 30.0f; // HeadlineFontSize + SectionTotalMargin;
|
const float HeadlineAndVMargin = HeadlineFontSize + SectionTotalMargin;
|
||||||
const float MarginToNextSection = 5.0f;
|
const float MarginToNextSection = 5.0f;
|
||||||
|
|
||||||
const float ColorPickerLabelSize = 13.0f;
|
const float ColorPickerLabelSize = 13.0f;
|
||||||
|
|
Loading…
Reference in a new issue