summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-07 01:06:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-07 01:06:40 +0300
commit7bbd2004db69dcf456a606a350d315e2fefa7d4f (patch)
treeb256c460bc3a6baa081ccab5596bc7d8aff0fab6
parent6b291b6515825f4ce0e09df5dec7ea1b619b63a7 (diff)
downloadplus-7bbd2004db69dcf456a606a350d315e2fefa7d4f.tar.gz
plus-7bbd2004db69dcf456a606a350d315e2fefa7d4f.tar.bz2
plus-7bbd2004db69dcf456a606a350d315e2fefa7d4f.tar.xz
plus-7bbd2004db69dcf456a606a350d315e2fefa7d4f.zip
Add option to print server name in screenshots.
Enabled by default.
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/game.cpp12
-rw-r--r--src/game.h2
-rw-r--r--src/gui/widgets/tabs/setup_visual.cpp7
4 files changed, 22 insertions, 0 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 7a110a539..1ca281f7c 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -358,6 +358,7 @@ DefaultsData* getConfigDefaults()
AddDEF("playMapAnimations", true);
AddDEF("usepets", true);
AddDEF("scale", 1);
+ AddDEF("addwatermark", true);
return configData;
}
diff --git a/src/game.cpp b/src/game.cpp
index b00dfc81f..df165d3d8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -48,6 +48,7 @@
#include "input/joystick.h"
#include "input/keyboardconfig.h"
+#include "gui/font.h"
#include "gui/gui.h"
#include "gui/viewport.h"
#include "gui/windowmenu.h"
@@ -479,6 +480,15 @@ Game::~Game()
PlayerInfo::gameDestroyed();
}
+void Game::addWatermark()
+{
+ if (!boldFont || !config.getBoolValue("addwatermark"))
+ return;
+ mainGraphics->setColorAll(Theme::getThemeColor(Theme::TEXT),
+ Theme::getThemeColor(Theme::TEXT_OUTLINE));
+ boldFont->drawString(mainGraphics, client->getServerName(), 100, 50);
+}
+
bool Game::createScreenshot()
{
if (!mainGraphics)
@@ -491,11 +501,13 @@ bool Game::createScreenshot()
mainGraphics->setSecure(true);
mainGraphics->prepareScreenshot();
gui->draw();
+ addWatermark();
screenshot = mainGraphics->getScreenshot();
mainGraphics->setSecure(false);
}
else
{
+ addWatermark();
screenshot = mainGraphics->getScreenshot();
}
diff --git a/src/game.h b/src/game.h
index 85d1d20d0..8f488c6ed 100644
--- a/src/game.h
+++ b/src/game.h
@@ -116,6 +116,8 @@ class Game final
static bool createScreenshot();
+ static void addWatermark();
+
static bool saveScreenshot(SDL_Surface *const screenshot);
void updateHistory(const SDL_Event &event);
diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp
index 9666b224a..860b1d516 100644
--- a/src/gui/widgets/tabs/setup_visual.cpp
+++ b/src/gui/widgets/tabs/setup_visual.cpp
@@ -203,6 +203,13 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
new SetupItemCheckBox(_("Allow screensaver to run"),
"", "allowscreensaver", this, "allowscreensaverEvent");
+
+ // TRANSLATORS: settings group
+ new SetupItemLabel(_("Screenshots"), "", this);
+
+ new SetupItemCheckBox(_("Add water mark into screenshots"),
+ "", "addwatermark", this, "addwatermarkEvent");
+
setDimension(Rect(0, 0, 550, 350));
}