Revert ingame menu close button

Even I got confused by it and accidentally hit power off button. Left
side seems not popular for close either (#5888)

Since opening the menu requires Escape, players can probably figure out
Escape to close it again.

> Revert "Don't show home button ingame"
>
> This reverts commit d3ff903d44.
>
> Revert "Move home button to very right so it is consistent with close button ingame (fixes #5881)"
>
> This reverts commit 9cc08cc9d3.
>
> Revert "Add close button to close ingame menu"
>
> This reverts commit cfcfb7b3f0.
This commit is contained in:
def 2022-10-02 23:57:28 +02:00
parent 3da9aebe4d
commit 9e5d830e34
2 changed files with 47 additions and 59 deletions

View file

@ -675,6 +675,49 @@ int CMenus::RenderMenubar(CUIRect r)
if(Client()->State() == IClient::STATE_OFFLINE)
{
Box.VSplitLeft(33.0f, &Button, &Box);
static CButtonContainer s_StartButton;
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_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);
bool GotNewsOrUpdate = false;
#if defined(CONF_AUTOUPDATE)
int State = Updater()->GetCurrentState();
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
if(State == IUpdater::CLEAN && NeedUpdate)
{
GotNewsOrUpdate = true;
}
#endif
GotNewsOrUpdate |= (bool)g_Config.m_UiUnreadNews;
ColorRGBA HomeButtonColorAlert(0, 1, 0, 0.25f);
ColorRGBA HomeButtonColorAlertHover(0, 1, 0, 0.5f);
ColorRGBA *pHomeButtonColor = NULL;
ColorRGBA *pHomeButtonColorHover = NULL;
const char *pHomeScreenButtonLabel = "\xEF\x80\x95";
if(GotNewsOrUpdate)
{
pHomeScreenButtonLabel = "\xEF\x87\xAA";
pHomeButtonColor = &HomeButtonColorAlert;
pHomeButtonColorHover = &HomeButtonColorAlertHover;
}
if(DoButton_MenuTab(&s_StartButton, pHomeScreenButtonLabel, false, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_HOME], pHomeButtonColor, pHomeButtonColor, pHomeButtonColorHover, 10.0f, 0))
{
m_ShowStart = true;
m_DoubleClickIndex = -1;
}
TextRender()->SetRenderFlags(0);
TextRender()->SetCurFont(NULL);
Box.VSplitLeft(10.0f, 0, &Box);
// offline menus
if(m_ActivePage == PAGE_NEWS)
{
@ -799,63 +842,9 @@ int CMenus::RenderMenubar(CUIRect r)
}
}
if(Client()->State() == IClient::STATE_OFFLINE)
{
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_StartButton;
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_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);
bool GotNewsOrUpdate = false;
#if defined(CONF_AUTOUPDATE)
int State = Updater()->GetCurrentState();
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
if(State == IUpdater::CLEAN && NeedUpdate)
{
GotNewsOrUpdate = true;
}
#endif
GotNewsOrUpdate |= (bool)g_Config.m_UiUnreadNews;
ColorRGBA HomeButtonColorAlert(0, 1, 0, 0.25f);
ColorRGBA HomeButtonColorAlertHover(0, 1, 0, 0.5f);
ColorRGBA *pHomeButtonColor = NULL;
ColorRGBA *pHomeButtonColorHover = NULL;
const char *pHomeScreenButtonLabel = "\xEF\x80\x95";
if(GotNewsOrUpdate)
{
pHomeScreenButtonLabel = "\xEF\x87\xAA";
pHomeButtonColor = &HomeButtonColorAlert;
pHomeButtonColorHover = &HomeButtonColorAlertHover;
}
if(DoButton_MenuTab(&s_StartButton, pHomeScreenButtonLabel, false, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_HOME], pHomeButtonColor, pHomeButtonColor, pHomeButtonColorHover, 10.0f, 0))
{
m_ShowStart = true;
m_DoubleClickIndex = -1;
}
Box.VSplitRight(5.0f, &Box, &Button);
}
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_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);
if(Client()->State() != IClient::STATE_OFFLINE)
{
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_CloseButton;
if(DoButton_MenuTab(&s_CloseButton, "\xE2\x9C\x95", 0, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_CLOSE], NULL, NULL, NULL, 10.0f, 0))
{
SetActive(!IsActive());
}
Box.VSplitRight(5.0f, &Box, &Button);
}
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_QuitButton;
ColorRGBA QuitColor(1, 0, 0, 0.5f);
@ -871,14 +860,14 @@ int CMenus::RenderMenubar(CUIRect r)
}
}
Box.VSplitRight(5.0f, &Box, &Button);
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_SettingsButton;
if(DoButton_MenuTab(&s_SettingsButton, "\xEF\x80\x93", m_ActivePage == PAGE_SETTINGS, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_SETTINGS], NULL, NULL, NULL, 10.0f, 0))
NewPage = PAGE_SETTINGS;
Box.VSplitRight(5.0f, &Box, &Button);
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_EditorButton;
if(DoButton_MenuTab(&s_EditorButton, "\xEF\x81\x84", 0, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_EDITOR], NULL, NULL, NULL, 10.0f, 0))
@ -888,14 +877,14 @@ int CMenus::RenderMenubar(CUIRect r)
if(Client()->State() == IClient::STATE_OFFLINE)
{
Box.VSplitRight(5.0f, &Box, &Button);
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_DemoButton;
if(DoButton_MenuTab(&s_DemoButton, "\xEE\x84\xB1", m_ActivePage == PAGE_DEMOS, &Button, IGraphics::CORNER_T, &m_aAnimatorsSmallPage[SMALL_TAB_DEMOBUTTON], NULL, NULL, NULL, 10.0f, 0))
NewPage = PAGE_DEMOS;
Box.VSplitRight(5.0f, &Box, &Button);
Box.VSplitRight(10.0f, &Box, &Button);
Box.VSplitRight(33.0f, &Box, &Button);
static CButtonContainer s_ServerButton;

View file

@ -612,7 +612,6 @@ public:
BIG_TAB_LENGTH,
SMALL_TAB_HOME = 0,
SMALL_TAB_CLOSE,
SMALL_TAB_QUIT,
SMALL_TAB_SETTINGS,
SMALL_TAB_EDITOR,