Add "Console" button to start menu

Add button to open the local console in the bottom left of the start menu to ensure that the local console is usable also when no physical keyboard (with F-keys) is available.
This commit is contained in:
Robert Müller 2024-08-26 20:49:40 +02:00
parent 028bd148f3
commit 56b9240594
2 changed files with 9 additions and 2 deletions

View file

@ -160,8 +160,6 @@ class CGameConsole : public CComponent
static const ColorRGBA ms_SearchHighlightColor;
static const ColorRGBA ms_SearchSelectedColor;
void Toggle(int Type);
static void PossibleCommandsRenderCallback(int Index, const char *pStr, void *pUser);
static void ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData);
static void ConToggleRemoteConsole(IConsole::IResult *pResult, void *pUserData);
@ -196,6 +194,7 @@ public:
virtual bool OnInput(const IInput::CEvent &Event) override;
void Prompt(char (&aPrompt)[32]);
void Toggle(int Type);
bool IsClosed() { return m_ConsoleState == CONSOLE_CLOSED; }
};
#endif

View file

@ -39,6 +39,14 @@ void CMenus::RenderStartMenu(CUIRect MainView)
MainView.VSplitLeft(30.0f, 0, &ExtMenu);
ExtMenu.VSplitLeft(100.0f, &ExtMenu, 0);
ExtMenu.HSplitBottom(20.0f, &ExtMenu, &Button);
ExtMenu.HSplitBottom(5.0f, &ExtMenu, nullptr);
static CButtonContainer s_ConsoleButton;
if(DoButton_Menu(&s_ConsoleButton, Localize("Console"), 0, &Button, nullptr, IGraphics::CORNER_ALL, 5.0f, 0.0f, ColorRGBA(0.0f, 0.0f, 0.0f, 0.25f)))
{
GameClient()->m_GameConsole.Toggle(CGameConsole::CONSOLETYPE_LOCAL);
}
ExtMenu.HSplitBottom(20.0f, &ExtMenu, &Button);
static CButtonContainer s_DiscordButton;
if(DoButton_Menu(&s_DiscordButton, Localize("Discord"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, ColorRGBA(0.0f, 0.0f, 0.0f, 0.25f)))