mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Use X icon for demo close button, remove DoButton_DemoPlayer
This commit is contained in:
parent
8b316d5045
commit
d9b5a8c3c4
|
@ -74,8 +74,7 @@ class CMenus : public CComponent
|
|||
static SColorPicker ms_ColorPicker;
|
||||
static bool ms_ValueSelectorTextMode;
|
||||
|
||||
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoButton_FontIcon(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, bool Enabled = true);
|
||||
int DoButton_FontIcon(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners = IGraphics::CORNER_ALL, bool Enabled = true);
|
||||
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
||||
int DoButton_Menu(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName = nullptr, int Corners = IGraphics::CORNER_ALL, float r = 5.0f, float FontFactor = 0.0f, vec4 ColorHot = vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4 Color = vec4(1, 1, 1, 0.5f), bool CheckForActiveColorPicker = false);
|
||||
int DoButton_MenuTab(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, SUIAnimator *pAnimator = nullptr, const ColorRGBA *pDefaultColor = nullptr, const ColorRGBA *pActiveColor = nullptr, const ColorRGBA *pHoverColor = nullptr, float EdgeRounding = 10);
|
||||
|
|
|
@ -28,13 +28,6 @@
|
|||
using namespace FontIcons;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
|
||||
{
|
||||
pRect->Draw(ColorRGBA(1, 1, 1, (Checked ? 0.10f : 0.5f) * UI()->ButtonColorMul(pID)), IGraphics::CORNER_ALL, 5.0f);
|
||||
UI()->DoLabel(pRect, pText, 14.0f, TEXTALIGN_MC);
|
||||
return UI()->DoButtonLogic(pID, Checked, pRect);
|
||||
}
|
||||
|
||||
int CMenus::DoButton_FontIcon(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, bool Enabled)
|
||||
{
|
||||
pRect->Draw(ColorRGBA(1.0f, 1.0f, 1.0f, (Checked ? 0.10f : 0.5f) * UI()->ButtonColorMul(pButtonContainer)), Corners, 5.0f);
|
||||
|
@ -508,13 +501,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));
|
||||
|
||||
// close button
|
||||
ButtonBar.VSplitRight(ButtonbarHeight * 3, &ButtonBar, &Button);
|
||||
static int s_ExitButton = 0;
|
||||
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button) || (Input()->KeyPress(KEY_C) && m_pClient->m_GameConsole.IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
|
||||
ButtonBar.VSplitRight(ButtonbarHeight, &ButtonBar, &Button);
|
||||
static CButtonContainer s_ExitButton;
|
||||
if(DoButton_FontIcon(&s_ExitButton, FONT_ICON_XMARK, 0, &Button) || (Input()->KeyPress(KEY_C) && m_pClient->m_GameConsole.IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
|
||||
{
|
||||
Client()->Disconnect();
|
||||
DemolistOnUpdate(false);
|
||||
}
|
||||
GameClient()->m_Tooltips.DoToolTip(&s_ExitButton, &Button, Localize("Close the demo player"));
|
||||
|
||||
// toggle keyboard shortcuts button
|
||||
ButtonBar.VSplitRight(Margins, &ButtonBar, nullptr);
|
||||
|
|
Loading…
Reference in a new issue