Move version information into the window caption.
On popular player request.
Fixes #4209.
#include "fontengine.h"
#include "joystick_controller.h"
#include "clientlauncher.h"
+#include "version.h"
/* mainmenumanager.h
*/
{
// Set the window caption
const wchar_t *text = wgettext("Main Menu");
- device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) + L" [" + text + L"]").c_str());
+ device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
+ L" " + utf8_to_wide(g_version_hash) +
+ L" [" + text + L"]").c_str());
delete[] text;
try { // This is used for catching disconnects
setStaticText(guitext_chat, recent_chat);
// Update gui element size and position
- s32 chat_y = 5 + line_height;
+ s32 chat_y = 5;
if (show_debug)
- chat_y += line_height;
+ chat_y += 2 * line_height;
// first pass to calculate height of text to be set
s32 width = std::min(g_fontengine->getTextWidth(recent_chat.c_str()) + 10,
/* Set window caption
*/
std::wstring str = utf8_to_wide(PROJECT_NAME_C);
+ str += L" ";
+ str += utf8_to_wide(g_version_hash);
str += L" [";
str += driver->getName();
str += L"]";
<< ", RTT = " << client->getRTT();
setStaticText(guitext, utf8_to_wide(os.str()).c_str());
guitext->setVisible(true);
- } else if (flags.show_hud || flags.show_chat) {
- std::ostringstream os(std::ios_base::binary);
- os << PROJECT_NAME_C " " << g_version_hash;
- setStaticText(guitext, utf8_to_wide(os.str()).c_str());
- guitext->setVisible(true);
} else {
guitext->setVisible(false);
}
m_sound_manager = &dummySoundManager;
//create topleft header
- m_toplefttext = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
- g_version_hash);
+ m_toplefttext = L"";
core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(m_toplefttext.c_str()),
g_fontengine->getTextHeight());
}
/******************************************************************************/
-void GUIEngine::setTopleftText(std::string append)
+void GUIEngine::setTopleftText(const std::string &text)
{
- std::wstring toset = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
- g_version_hash);
-
- if (append != "")
- {
- toset += L" / ";
- toset += utf8_to_wide(append);
- }
-
- m_toplefttext = toset;
+ m_toplefttext = utf8_to_wide(text);
updateTopLeftTextSize();
}
void drawVersion();
/**
- * specify text to be appended to version string
+ * specify text to appear as top left string
* @param text to set
*/
- void setTopleftText(std::string append);
+ void setTopleftText(const std::string &text);
/** pointer to gui element shown at topleft corner */
irr::gui::IGUIStaticText* m_irr_toplefttext;