Merge pull request #7551 from furo321/align-vote-menu

Fix alignment of buttons in vote menu.
This commit is contained in:
Robert Müller 2023-11-26 18:51:04 +00:00 committed by GitHub
commit fc8728bcb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -631,7 +631,6 @@ void CMenus::RenderServerControl(CUIRect MainView)
MainView.HSplitBottom(90.0f, &MainView, &RconExtension);
// tab bar
{
TabBar.VSplitLeft(TabBar.w / 3, &Button, &TabBar);
static CButtonContainer s_Button0;
if(DoButton_MenuTab(&s_Button0, Localize("Change settings"), s_ControlPage == 0, &Button, 0))
@ -645,7 +644,6 @@ void CMenus::RenderServerControl(CUIRect MainView)
static CButtonContainer s_Button2;
if(DoButton_MenuTab(&s_Button2, Localize("Move player to spectators"), s_ControlPage == 2, &TabBar, 0))
s_ControlPage = 2;
}
// render page
MainView.HSplitBottom(ms_ButtonHeight + 5 * 2, &MainView, &Bottom);
@ -660,12 +658,11 @@ void CMenus::RenderServerControl(CUIRect MainView)
Call = RenderServerControlKick(MainView, true);
// vote menu
{
CUIRect QuickSearch;
// render quick search
{
Bottom.VSplitLeft(240.0f, &QuickSearch, &Bottom);
Bottom.VSplitLeft(5.0f, 0, &Bottom);
Bottom.VSplitLeft(250.0f, &QuickSearch, &Bottom);
QuickSearch.HSplitTop(5.0f, 0, &QuickSearch);
TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
@ -685,9 +682,11 @@ void CMenus::RenderServerControl(CUIRect MainView)
}
m_FilterInput.SetEmptyText(Localize("Search"));
UI()->DoClearableEditBox(&m_FilterInput, &QuickSearch, 14.0f);
}
// call vote
Bottom.VSplitRight(10.0f, &Bottom, 0);
Bottom.VSplitRight(120.0f, &Bottom, &Button);
Button.HSplitTop(5.0f, 0, &Button);
static CButtonContainer s_CallVoteButton;
if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button) || Call)
@ -721,8 +720,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
// render kick reason
CUIRect Reason;
Bottom.VSplitRight(40.0f, &Bottom, 0);
Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Bottom.VSplitRight(20.0f, &Bottom, 0);
Bottom.VSplitRight(200.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:");
UI()->DoLabel(&Reason, pLabel, 14.0f, TEXTALIGN_ML);
@ -739,7 +738,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(Client()->RconAuthed())
{
// background
RconExtension.Margin(10.0f, &RconExtension);
RconExtension.HSplitTop(10.0f, 0, &RconExtension);
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
RconExtension.HSplitTop(5.0f, 0, &RconExtension);
@ -791,8 +790,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
Bottom.VSplitLeft(20.0f, 0, &Button);
UI()->DoLabel(&Button, Localize("Vote command:"), 14.0f, TEXTALIGN_ML);
static CLineInputBuffered<64> s_VoteDescriptionInput;
static CLineInputBuffered<512> s_VoteCommandInput;
static CLineInputBuffered<VOTE_DESC_LENGTH> s_VoteDescriptionInput;
static CLineInputBuffered<VOTE_CMD_LENGTH> s_VoteCommandInput;
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
Bottom.VSplitRight(10.0f, &Bottom, 0);
Bottom.VSplitRight(120.0f, &Bottom, &Button);
@ -809,7 +808,6 @@ void CMenus::RenderServerControl(CUIRect MainView)
UI()->DoEditBox(&s_VoteCommandInput, &Button, 14.0f);
}
}
}
}
void CMenus::RenderInGameNetwork(CUIRect MainView)