Index: ps/trunk/source/ps/CConsole.h =================================================================== --- ps/trunk/source/ps/CConsole.h +++ ps/trunk/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_QuitHotkeyWasShown; // 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: ps/trunk/source/ps/CConsole.cpp =================================================================== --- ps/trunk/source/ps/CConsole.cpp +++ ps/trunk/source/ps/CConsole.cpp @@ -80,7 +80,9 @@ m_bCursorVisState = true; m_cursorBlinkRate = 0.5; - InsertMessage("[ 0 A.D. Console v0.14 ]"); + m_QuitHotkeyWasShown = false; + + InsertMessage("[ 0 A.D. Console v0.15 ]"); InsertMessage(""); } @@ -121,6 +123,22 @@ m_fHeight = height / g_VideoMode.GetScale(); } +void CConsole::ShowQuitHotkeys() +{ + if (m_QuitHotkeyWasShown) + return; + + std::string str; + for (const std::pair& key : g_HotkeyMap) + if (key.second.front().name == "console.toggle") + str += (str.empty() ? "Press " : " / ") + FindScancodeName(static_cast(key.first)); + + if (!str.empty()) + InsertMessage(str + " to quit."); + + m_QuitHotkeyWasShown = true; +} + void CConsole::ToggleVisible() { m_bToggle = true; @@ -128,9 +146,12 @@ // TODO: this should be based on input focus, not visibility if (m_bVisible) + { + ShowQuitHotkeys(); SDL_StartTextInput(); - else - SDL_StopTextInput(); + return; + } + SDL_StopTextInput(); } void CConsole::SetVisible(bool visible)