Skip to content

Commit

Permalink
Remove top left minetest watermark
Browse files Browse the repository at this point in the history
Move version information into the window caption.

On popular player request.

Fixes #4209.
  • Loading branch information
est31 committed Jul 3, 2016
1 parent 3c63c30 commit e1aa98f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
5 changes: 4 additions & 1 deletion src/client/clientlauncher.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "fontengine.h" #include "fontengine.h"
#include "joystick_controller.h" #include "joystick_controller.h"
#include "clientlauncher.h" #include "clientlauncher.h"
#include "version.h"


/* mainmenumanager.h /* mainmenumanager.h
*/ */
Expand Down Expand Up @@ -185,7 +186,9 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
{ {
// Set the window caption // Set the window caption
const wchar_t *text = wgettext("Main Menu"); 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; delete[] text;


try { // This is used for catching disconnects try { // This is used for catching disconnects
Expand Down
11 changes: 4 additions & 7 deletions src/game.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1273,10 +1273,10 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
setStaticText(guitext_chat, recent_chat); setStaticText(guitext_chat, recent_chat);


// Update gui element size and position // Update gui element size and position
s32 chat_y = 5 + line_height; s32 chat_y = 5;


if (show_debug) if (show_debug)
chat_y += line_height; chat_y += 2 * line_height;


// first pass to calculate height of text to be set // first pass to calculate height of text to be set
s32 width = std::min(g_fontengine->getTextWidth(recent_chat.c_str()) + 10, s32 width = std::min(g_fontengine->getTextWidth(recent_chat.c_str()) + 10,
Expand Down Expand Up @@ -2205,6 +2205,8 @@ bool Game::createClient(const std::string &playername,
/* Set window caption /* Set window caption
*/ */
std::wstring str = utf8_to_wide(PROJECT_NAME_C); std::wstring str = utf8_to_wide(PROJECT_NAME_C);
str += L" ";
str += utf8_to_wide(g_version_hash);
str += L" ["; str += L" [";
str += driver->getName(); str += driver->getName();
str += L"]"; str += L"]";
Expand Down Expand Up @@ -4347,11 +4349,6 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
<< ", RTT = " << client->getRTT(); << ", RTT = " << client->getRTT();
setStaticText(guitext, utf8_to_wide(os.str()).c_str()); setStaticText(guitext, utf8_to_wide(os.str()).c_str());
guitext->setVisible(true); 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 { } else {
guitext->setVisible(false); guitext->setVisible(false);
} }
Expand Down
16 changes: 3 additions & 13 deletions src/guiEngine.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
m_sound_manager = &dummySoundManager; m_sound_manager = &dummySoundManager;


//create topleft header //create topleft header
m_toplefttext = utf8_to_wide(std::string(PROJECT_NAME_C " ") + m_toplefttext = L"";
g_version_hash);


core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(m_toplefttext.c_str()), core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(m_toplefttext.c_str()),
g_fontengine->getTextHeight()); g_fontengine->getTextHeight());
Expand Down Expand Up @@ -571,18 +570,9 @@ bool GUIEngine::downloadFile(std::string url, std::string target)
} }


/******************************************************************************/ /******************************************************************************/
void GUIEngine::setTopleftText(std::string append) void GUIEngine::setTopleftText(const std::string &text)
{ {
std::wstring toset = utf8_to_wide(std::string(PROJECT_NAME_C " ") + m_toplefttext = utf8_to_wide(text);
g_version_hash);

if (append != "")
{
toset += L" / ";
toset += utf8_to_wide(append);
}

m_toplefttext = toset;


updateTopLeftTextSize(); updateTopLeftTextSize();
} }
Expand Down
4 changes: 2 additions & 2 deletions src/guiEngine.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ class GUIEngine {
void drawVersion(); void drawVersion();


/** /**
* specify text to be appended to version string * specify text to appear as top left string
* @param text to set * @param text to set
*/ */
void setTopleftText(std::string append); void setTopleftText(const std::string &text);


/** pointer to gui element shown at topleft corner */ /** pointer to gui element shown at topleft corner */
irr::gui::IGUIStaticText* m_irr_toplefttext; irr::gui::IGUIStaticText* m_irr_toplefttext;
Expand Down

0 comments on commit e1aa98f

Please sign in to comment.