MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetScreenshotWindowVisibility

Function SetScreenshotWindowVisibility

src/screenshot_gui.cpp:84–99  ·  view source on GitHub ↗

* 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? */

Source from the content-addressed store, hash-verified

82 * @param hide Are we hiding the window or showing it again after the screenshot is taken?
83 */
84void SetScreenshotWindowVisibility(bool hide)
85{
86 ScreenshotWindow *scw = dynamic_cast<ScreenshotWindow *>(FindWindowById(WC_SCREENSHOT, 0));
87
88 if (scw == nullptr) return;
89
90 if (hide) {
91 /* Set dirty the screen area where the window is covering (not the window itself), then move window off screen. */
92 scw->SetDirty();
93 scw->left += 2 * _screen.width;
94 } else {
95 /* Return window to original position. */
96 scw->left -= 2 * _screen.width;
97 scw->SetDirty();
98 }
99}

Callers 1

RealMakeScreenshotFunction · 0.85

Calls 2

FindWindowByIdFunction · 0.85
SetDirtyMethod · 0.45

Tested by

no test coverage detected