OpenTTD Source
1.11.2
|
Go to the source code of this file.
Enumerations | |
enum | ScreenshotType { SC_VIEWPORT, SC_CRASHLOG, SC_ZOOMEDIN, SC_DEFAULTZOOM, SC_WORLD, SC_HEIGHTMAP, SC_MINIMAP } |
Type of requested screenshot. More... | |
Functions | |
void | InitializeScreenshotFormats () |
Initialize screenshot format information on startup, with _screenshot_format_name filled from the loadsave code. | |
const char * | GetCurrentScreenshotExtension () |
Get filename extension of current screenshot file format. | |
void | SetupScreenshotViewport (ScreenshotType t, struct Viewport *vp, uint32 width=0, uint32 height=0) |
Configure a Viewport for rendering (a part of) the map into a screenshot. More... | |
bool | MakeHeightmapScreenshot (const char *filename) |
Make a heightmap of the current map. More... | |
void | MakeScreenshotWithConfirm (ScreenshotType t) |
Make a screenshot. More... | |
bool | MakeScreenshot (ScreenshotType t, std::string name, uint32 width=0, uint32 height=0) |
Schedule making a screenshot. More... | |
bool | MakeMinimapWorldScreenshot () |
Make a minimap screenshot. | |
Variables | |
char | _screenshot_format_name [8] |
Extension of the current screenshot format (corresponds with _cur_screenshot_format). | |
uint | _num_screenshot_formats |
Number of available screenshot formats. | |
uint | _cur_screenshot_format |
Index of the currently selected screenshot format in _screenshot_formats. | |
char | _full_screenshot_name [MAX_PATH] |
Pathname of the screenshot file. | |
Functions to make screenshots.
Definition in file screenshot.h.
enum ScreenshotType |
Type of requested screenshot.
Definition at line 18 of file screenshot.h.
bool MakeHeightmapScreenshot | ( | const char * | filename | ) |
Make a heightmap of the current map.
filename | Filename to use for saving. |
Definition at line 838 of file screenshot.cpp.
References _cur_screenshot_format, _heightmap_highest_peak, _screenshot_formats, Colour::a, HeightmapCallback(), lengthof, MapSize(), MapSizeX(), MapSizeY(), ScreenshotFormat::proc, and TileHeight().
bool MakeScreenshot | ( | ScreenshotType | t, |
std::string | name, | ||
uint32 | width, | ||
uint32 | height | ||
) |
Schedule making a screenshot.
Unconditionally take a screenshot of the requested type.
t | the type of screenshot to make. |
name | the name to give to the screenshot. |
width | the width of the screenshot of, or 0 for current viewport width (only works for SC_ZOOMEDIN and SC_DEFAULTZOOM). |
height | the height of the screenshot of, or 0 for current viewport height (only works for SC_ZOOMEDIN and SC_DEFAULTZOOM). |
Definition at line 978 of file screenshot.cpp.
References VideoDriver::GetInstance(), lock, VideoDriver::QueueOnMainThread(), RealMakeScreenshot(), and SC_CRASHLOG.
Referenced by MakeScreenshotWithConfirm(), and ScreenshotConfirmationCallback().
void MakeScreenshotWithConfirm | ( | ScreenshotType | t | ) |
Make a screenshot.
Ask for confirmation first if the screenshot will be huge.
t | Screenshot type: World, defaultzoom, heightmap or viewport screenshot |
Definition at line 876 of file screenshot.cpp.
References _confirmed_screenshot_type, Viewport::height, MakeScreenshot(), MapSizeX(), MapSizeY(), SC_HEIGHTMAP, SC_MINIMAP, ScreenshotConfirmationCallback(), SetDParam(), SetupScreenshotViewport(), ShowQuery(), and Viewport::width.
Referenced by ScreenshotWindow::OnClick().
void SetupScreenshotViewport | ( | ScreenshotType | t, |
Viewport * | vp, | ||
uint32 | width, | ||
uint32 | height | ||
) |
Configure a Viewport for rendering (a part of) the map into a screenshot.
t | Screenshot type | |
width | the width of the screenshot, or 0 for current viewport width (needs to be 0 with SC_VIEWPORT, SC_CRASHLOG, and SC_WORLD). | |
height | the height of the screenshot, or 0 for current viewport height (needs to be 0 with SC_VIEWPORT, SC_CRASHLOG, and SC_WORLD). | |
[out] | vp | Result viewport |
Definition at line 718 of file screenshot.cpp.
References FindWindowById(), Viewport::left, SC_CRASHLOG, SC_VIEWPORT, Viewport::top, Window::viewport, Viewport::virtual_height, Viewport::virtual_left, Viewport::virtual_top, Viewport::virtual_width, WC_MAIN_WINDOW, and Viewport::width.
Referenced by MakeLargeWorldScreenshot(), and MakeScreenshotWithConfirm().