1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Re-introduce message on successful screenshot (#21983)

* Re-introduce message on successful screenshot

* Automatically close previous screenshot notices before new ones
This commit is contained in:
Aaron van Geffen
2024-05-10 15:04:12 +02:00
committed by GitHub
parent ba9c84f835
commit 347ce53f26
9 changed files with 44 additions and 21 deletions

View File

@@ -26,6 +26,7 @@
#include "../drawing/X8DrawingEngine.h"
#include "../localisation/Formatter.h"
#include "../localisation/Localisation.h"
#include "../paint/Painter.h"
#include "../platform/Platform.h"
#include "../util/Util.h"
#include "../world/Climate.h"
@@ -91,10 +92,17 @@ void ScreenshotCheck()
if (!screenshotPath.empty())
{
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 100, ContextGetWidth() / 2);
// Show user that screenshot saved successfully
const auto filename = Path::GetFileName(screenshotPath);
Formatter ft;
ft.Add<StringId>(STR_STRING);
ft.Add<const utf8*>(filename.c_str());
ContextShowError(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft, true);
}
else
{
ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {});
ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {}, true);
}
// redraw_weather();
@@ -384,12 +392,12 @@ void ScreenshotGiant()
Formatter ft;
ft.Add<StringId>(STR_STRING);
ft.Add<const utf8*>(filename.c_str());
ContextShowError(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft);
ContextShowError(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft, true);
}
catch (const std::exception& e)
{
LOG_ERROR("%s", e.what());
ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {});
ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {}, true);
}
ReleaseDPI(dpi);