mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: Don't show screenshot GUI in screenshots (#9674)
This commit is contained in:
parent
d0655a48ba
commit
08cb5ba2cd
|
@ -12,6 +12,7 @@
|
||||||
#include "viewport_func.h"
|
#include "viewport_func.h"
|
||||||
#include "gfx_func.h"
|
#include "gfx_func.h"
|
||||||
#include "screenshot.h"
|
#include "screenshot.h"
|
||||||
|
#include "screenshot_gui.h"
|
||||||
#include "blitter/factory.hpp"
|
#include "blitter/factory.hpp"
|
||||||
#include "zoom_func.h"
|
#include "zoom_func.h"
|
||||||
#include "core/endian_func.hpp"
|
#include "core/endian_func.hpp"
|
||||||
|
@ -909,8 +910,10 @@ static bool RealMakeScreenshot(ScreenshotType t, std::string name, uint32 width,
|
||||||
* of the screenshot. This way the screenshot will always show the name
|
* of the screenshot. This way the screenshot will always show the name
|
||||||
* of the previous screenshot in the 'successful' message instead of the
|
* of the previous screenshot in the 'successful' message instead of the
|
||||||
* name of the new screenshot (or an empty name). */
|
* name of the new screenshot (or an empty name). */
|
||||||
|
SetScreenshotWindowVisibility(true);
|
||||||
UndrawMouseCursor();
|
UndrawMouseCursor();
|
||||||
DrawDirtyBlocks();
|
DrawDirtyBlocks();
|
||||||
|
SetScreenshotWindowVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenshot_name[0] = '\0';
|
_screenshot_name[0] = '\0';
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "screenshot.h"
|
#include "screenshot.h"
|
||||||
#include "widgets/screenshot_widget.h"
|
#include "widgets/screenshot_widget.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
#include "gfx_func.h"
|
||||||
|
|
||||||
struct ScreenshotWindow : Window {
|
struct ScreenshotWindow : Window {
|
||||||
ScreenshotWindow(WindowDesc *desc) : Window(desc)
|
ScreenshotWindow(WindowDesc *desc) : Window(desc)
|
||||||
|
@ -72,3 +73,24 @@ void ShowScreenshotWindow()
|
||||||
CloseWindowById(WC_SCREENSHOT, 0);
|
CloseWindowById(WC_SCREENSHOT, 0);
|
||||||
new ScreenshotWindow(&_screenshot_window_desc);
|
new ScreenshotWindow(&_screenshot_window_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the visibility of the screenshot window when taking a screenshot.
|
||||||
|
* @param hide Are we hiding the window or showing it again after the screenshot is taken?
|
||||||
|
*/
|
||||||
|
void SetScreenshotWindowVisibility(bool hide)
|
||||||
|
{
|
||||||
|
ScreenshotWindow *scw = (ScreenshotWindow *)FindWindowById(WC_SCREENSHOT, 0);
|
||||||
|
|
||||||
|
if (scw == nullptr) return;
|
||||||
|
|
||||||
|
if (hide) {
|
||||||
|
/* Set dirty the screen area where the window is covering (not the window itself), then move window off screen. */
|
||||||
|
scw->SetDirty();
|
||||||
|
scw->left += 2 * _screen.width;
|
||||||
|
} else {
|
||||||
|
/* Return window to original position. */
|
||||||
|
scw->left -= 2 * _screen.width;
|
||||||
|
scw->SetDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,5 +11,6 @@
|
||||||
#define SCREENSHOT_GUI_H
|
#define SCREENSHOT_GUI_H
|
||||||
|
|
||||||
void ShowScreenshotWindow();
|
void ShowScreenshotWindow();
|
||||||
|
void SetScreenshotWindowVisibility(bool hide);
|
||||||
|
|
||||||
#endif /* SCREENSHOT_GUI_H */
|
#endif /* SCREENSHOT_GUI_H */
|
||||||
|
|
Loading…
Reference in New Issue