Index: source/ps/CConsole.h =================================================================== --- source/ps/CConsole.h +++ source/ps/CConsole.h @@ -110,6 +110,7 @@ bool m_bToggle; // show/hide animation is currently active double m_prevTime; // the previous time the cursor draw state changed (used for blinking cursor) bool m_bCursorVisState; // if the cursor should be drawn or not + bool m_bShowQuitHotkey; // show console.toggle hotkey values at first time double m_cursorBlinkRate; // cursor blink rate in seconds, if greater than 0.0 void DrawWindow(CCanvas2D& canvas); @@ -128,6 +129,7 @@ void LoadHistory(); void SaveHistory(); + void ShowQuitHotkeys(); }; extern CConsole* g_Console; Index: source/ps/CConsole.cpp =================================================================== --- source/ps/CConsole.cpp +++ source/ps/CConsole.cpp @@ -80,7 +80,9 @@ m_bCursorVisState = true; m_cursorBlinkRate = 0.5; - InsertMessage("[ 0 A.D. Console v0.14 ]"); + m_bShowQuitHotkey = true; + + InsertMessage("[ 0 A.D. Console v0.15 ]"); InsertMessage(""); } @@ -121,6 +123,21 @@ m_fHeight = height / g_VideoMode.GetScale(); } +void CConsole::ShowQuitHotkeys() +{ + if(!m_bShowQuitHotkey) + return; + + std::string str = "Press"; + for (const std::pair& key : g_HotkeyMap) + if (key.second.front().name == "console.toggle") + str = str + " " + FindScancodeName(static_cast(key.first)); + + InsertMessage(str + " to quit."); + + m_bShowQuitHotkey = false; +} + void CConsole::ToggleVisible() { m_bToggle = true; @@ -128,9 +145,12 @@ // TODO: this should be based on input focus, not visibility if (m_bVisible) + { SDL_StartTextInput(); - else - SDL_StopTextInput(); + ShowQuitHotkeys(); + return; + } + SDL_StopTextInput(); } void CConsole::SetVisible(bool visible)