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