Skip to content

Commit

Permalink
Fix overall spacing in tclient menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Nov 23, 2024
1 parent 67fd4d1 commit ae45100
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3234,11 +3234,12 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
const float LineSize = 20.0f;
const float ColorPickerLineSize = 25.0f;
const float HeadlineFontSize = 20.0f;
const float HeadlineHeight = 30.0f;
const float HeadlineHeight = HeadlineFontSize + 0.0f;
const float Margin = 10.0f;
const float MarginSmall = 5.0f;
const float MarginExtraSmall = 2.5f;
const float MarignBetweenSections = MarginSmall * 2.0f + MarginExtraSmall;
const float MarginBetweenViews = 20.0f - MarginExtraSmall;
const float MarignBetweenSections = 30.0f;
const float MarginBetweenViews = 30.0f;

const float ColorPickerLabelSize = 13.0f;
const float ColorPickerLineSpacing = 5.0f;
Expand Down Expand Up @@ -3288,13 +3289,17 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
MainView.VSplitLeft(5.0f, nullptr, &MainView); // Padding for scrollbar

MainView.VSplitMid(&LeftView, &RightView, MarginBetweenViews);
LeftView.VSplitLeft(MarginSmall, nullptr, &LeftView);
RightView.VSplitRight(MarginSmall, &RightView, nullptr);

//RightView.VSplitRight(10.0f, &RightView, nullptr);
for(CUIRect &Section : s_SectionBoxes)
{
Section.w += MarginSmall * 2.0f;
Section.h += MarginSmall;
Section.x -= MarginSmall;
//Section.y -= MarginExtraSmall * 0.5;
float Padding = MarginBetweenViews * 0.6666f;
Section.w += Padding;
Section.h += Padding;
Section.x -= Padding * 0.5f;
Section.y -= Padding * 0.5f;
Section.y -= s_PrevScrollOffset.y - ScrollOffset.y;
float Shade = 0.0f;
Section.Draw(ColorRGBA(Shade, Shade, Shade, 0.25f), IGraphics::CORNER_ALL, 10.0f);
Expand All @@ -3306,7 +3311,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Column = LeftView;

// ***** Visual Miscellaneous ***** //
Column.HSplitTop(MarignBetweenSections, nullptr, &Column);
Column.HSplitTop(Margin, nullptr, &Column);
s_SectionBoxes.push_back(Column);
Column.HSplitTop(HeadlineHeight, &Label, &Column);
Ui()->DoLabel(&Label, Localize("Visual"), HeadlineFontSize, TEXTALIGN_ML);
Expand All @@ -3321,14 +3326,17 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHammerRotatesWithCursor, Localize("Make hammer rotate with cursor"), &g_Config.m_ClHammerRotatesWithCursor, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClWhiteFeet, Localize("Render all custom colored feet as white feet skin"), &g_Config.m_ClWhiteFeet, &Column, LineSize);
CUIRect FeetBox;
Column.HSplitTop(LineSize, &FeetBox, &Column);
Column.HSplitTop(LineSize + MarginExtraSmall, &FeetBox, &Column);
if(g_Config.m_ClWhiteFeet)
{
FeetBox.HSplitTop(MarginExtraSmall, nullptr, &FeetBox);
FeetBox.VSplitMid(&FeetBox, nullptr);
static CLineInput s_WhiteFeet(g_Config.m_ClWhiteFeetSkin, sizeof(g_Config.m_ClWhiteFeetSkin));
s_WhiteFeet.SetEmptyText("x_ninja");
Ui()->DoEditBox(&s_WhiteFeet, &FeetBox, 12.0f);
}
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);

s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;

// ***** Input ***** //
Expand Down Expand Up @@ -3410,6 +3418,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
if(!open_link("https://ger10.ddnet.org/"))
dbg_msg("menus", "couldn't open link");
}
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);
s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;

// ***** Player Indicator ***** //
Expand Down Expand Up @@ -3456,7 +3465,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Column = RightView;

// ***** HUD ***** //
Column.HSplitTop(MarignBetweenSections, nullptr, &Column);
Column.HSplitTop(Margin, nullptr, &Column);
s_SectionBoxes.push_back(Column);
Column.HSplitTop(HeadlineHeight, &Label, &Column);
Ui()->DoLabel(&Label, Localize("HUD"), HeadlineFontSize, TEXTALIGN_ML);
Expand All @@ -3467,16 +3476,18 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderCursorSpec, Localize("Show your cursor when in free spectate"), &g_Config.m_ClRenderCursorSpec, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClNotifyWhenLast, Localize("Show when you are the last alive"), &g_Config.m_ClNotifyWhenLast, &Column, LineSize);
CUIRect NotificationConfig;
Column.HSplitTop(LineSize, &NotificationConfig, &Column);
Column.HSplitTop(LineSize + MarginSmall, &NotificationConfig, &Column);
if(g_Config.m_ClNotifyWhenLast)
{
NotificationConfig.VSplitMid(&Button, &NotificationConfig);
static CLineInput s_LastInput(g_Config.m_ClNotifyWhenLastText, sizeof(g_Config.m_ClNotifyWhenLastText));
s_LastInput.SetEmptyText(Localize("Last Alive!"));
s_LastInput.SetEmptyText(Localize("Last!"));
Button.HSplitTop(MarginSmall, nullptr, &Button);
Ui()->DoEditBox(&s_LastInput, &Button, 12.0f);
static CButtonContainer s_ClientNotifyWhenLastColor;
DoLine_ColorPicker(&s_ClientNotifyWhenLastColor, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &NotificationConfig, "", &g_Config.m_ClNotifyWhenLastColor, ColorRGBA(1.0f, 1.0f, 1.0f), false);
}
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);
s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;

// ***** Frozen Tee Display ***** //
Expand Down Expand Up @@ -3587,6 +3598,7 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
if(NewId != 0)
m_pClient->m_Binds.Bind(NewId, Key.m_pCommand, false, NewModifierCombination);
}
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);
s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;

// ***** Rainbow ***** //
Expand All @@ -3612,8 +3624,10 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
RainbowSelectedOld = RainbowSelectedNew;
dbg_msg("rainbow", "rainbow mode changed to %d", g_Config.m_ClRainbowMode);
}
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);
s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;

Column.HSplitTop(MarginSmall, nullptr, &Column);
// ***** END OF PAGE 1 SETTINGS ***** //
RightView = Column;

Expand Down

0 comments on commit ae45100

Please sign in to comment.