Skip to content

Commit e1aa98f

Browse files
committedJul 3, 2016
Remove top left minetest watermark
Move version information into the window caption. On popular player request. Fixes #4209.
1 parent 3c63c30 commit e1aa98f

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed
 

‎src/client/clientlauncher.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3434
#include "fontengine.h"
3535
#include "joystick_controller.h"
3636
#include "clientlauncher.h"
37+
#include "version.h"
3738

3839
/* mainmenumanager.h
3940
*/
@@ -185,7 +186,9 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
185186
{
186187
// Set the window caption
187188
const wchar_t *text = wgettext("Main Menu");
188-
device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) + L" [" + text + L"]").c_str());
189+
device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
190+
L" " + utf8_to_wide(g_version_hash) +
191+
L" [" + text + L"]").c_str());
189192
delete[] text;
190193

191194
try { // This is used for catching disconnects

‎src/game.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -1273,10 +1273,10 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
12731273
setStaticText(guitext_chat, recent_chat);
12741274

12751275
// Update gui element size and position
1276-
s32 chat_y = 5 + line_height;
1276+
s32 chat_y = 5;
12771277

12781278
if (show_debug)
1279-
chat_y += line_height;
1279+
chat_y += 2 * line_height;
12801280

12811281
// first pass to calculate height of text to be set
12821282
s32 width = std::min(g_fontengine->getTextWidth(recent_chat.c_str()) + 10,
@@ -2205,6 +2205,8 @@ bool Game::createClient(const std::string &playername,
22052205
/* Set window caption
22062206
*/
22072207
std::wstring str = utf8_to_wide(PROJECT_NAME_C);
2208+
str += L" ";
2209+
str += utf8_to_wide(g_version_hash);
22082210
str += L" [";
22092211
str += driver->getName();
22102212
str += L"]";
@@ -4347,11 +4349,6 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
43474349
<< ", RTT = " << client->getRTT();
43484350
setStaticText(guitext, utf8_to_wide(os.str()).c_str());
43494351
guitext->setVisible(true);
4350-
} else if (flags.show_hud || flags.show_chat) {
4351-
std::ostringstream os(std::ios_base::binary);
4352-
os << PROJECT_NAME_C " " << g_version_hash;
4353-
setStaticText(guitext, utf8_to_wide(os.str()).c_str());
4354-
guitext->setVisible(true);
43554352
} else {
43564353
guitext->setVisible(false);
43574354
}

‎src/guiEngine.cpp

+3-13
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
174174
m_sound_manager = &dummySoundManager;
175175

176176
//create topleft header
177-
m_toplefttext = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
178-
g_version_hash);
177+
m_toplefttext = L"";
179178

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

573572
/******************************************************************************/
574-
void GUIEngine::setTopleftText(std::string append)
573+
void GUIEngine::setTopleftText(const std::string &text)
575574
{
576-
std::wstring toset = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
577-
g_version_hash);
578-
579-
if (append != "")
580-
{
581-
toset += L" / ";
582-
toset += utf8_to_wide(append);
583-
}
584-
585-
m_toplefttext = toset;
575+
m_toplefttext = utf8_to_wide(text);
586576

587577
updateTopLeftTextSize();
588578
}

‎src/guiEngine.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ class GUIEngine {
270270
void drawVersion();
271271

272272
/**
273-
* specify text to be appended to version string
273+
* specify text to appear as top left string
274274
* @param text to set
275275
*/
276-
void setTopleftText(std::string append);
276+
void setTopleftText(const std::string &text);
277277

278278
/** pointer to gui element shown at topleft corner */
279279
irr::gui::IGUIStaticText* m_irr_toplefttext;

0 commit comments

Comments
 (0)
Please sign in to comment.