From 7bbd2004db69dcf456a606a350d315e2fefa7d4f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 7 Mar 2014 01:06:40 +0300 Subject: Add option to print server name in screenshots. Enabled by default. --- src/defaults.cpp | 1 + src/game.cpp | 12 ++++++++++++ src/game.h | 2 ++ src/gui/widgets/tabs/setup_visual.cpp | 7 +++++++ 4 files changed, 22 insertions(+) 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)); } -- cgit v1.2.3-70-g09d2