OpenTTD Source 20241224-master-gee860a5c8e
|
Functions to make screenshots. More...
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_t width=0, uint32_t height=0) |
Configure a Viewport for rendering (a part of) the map into a screenshot. | |
bool | MakeHeightmapScreenshot (const char *filename) |
Make a heightmap of the current map. | |
void | MakeScreenshotWithConfirm (ScreenshotType t) |
Make a screenshot. | |
bool | MakeScreenshot (ScreenshotType t, std::string name, uint32_t width=0, uint32_t height=0) |
Schedule making a screenshot. | |
bool | MakeMinimapWorldScreenshot () |
Make a minimap screenshot. | |
Variables | |
std::string | _screenshot_format_name |
Extension of the current screenshot format (corresponds with _cur_screenshot_format). | |
std::string | _full_screenshot_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.
const char * GetCurrentScreenshotExtension | ( | ) |
Get filename extension of current screenshot file format.
Definition at line 554 of file screenshot.cpp.
References ScreenshotFormat::extension.
Referenced by FiosMakeHeightmapName().
void InitializeScreenshotFormats | ( | ) |
Initialize screenshot format information on startup, with _screenshot_format_name filled from the loadsave code.
Definition at line 560 of file screenshot.cpp.
References _screenshot_format_name, and _screenshot_formats.
Referenced by openttd_main().
bool MakeHeightmapScreenshot | ( | const char * | filename | ) |
Make a heightmap of the current map.
filename | Filename to use for saving. |
Definition at line 811 of file screenshot.cpp.
References _heightmap_highest_peak, Colour::b, HeightmapCallback(), Map::Iterate(), lengthof, ScreenshotFormat::proc, Map::SizeX(), Map::SizeY(), and TileHeight().
Referenced by RealMakeScreenshot().
bool MakeMinimapWorldScreenshot | ( | ) |
Make a minimap screenshot.
Definition at line 990 of file screenshot.cpp.
References _cur_palette, ScreenshotFormat::extension, MakeScreenshotName(), Palette::palette, ScreenshotFormat::proc, SCREENSHOT_NAME, Map::SizeX(), and Map::SizeY().
Referenced by RealMakeScreenshot().
bool MakeScreenshot | ( | ScreenshotType | t, |
std::string | name, | ||
uint32_t | width, | ||
uint32_t | 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 949 of file screenshot.cpp.
References VideoDriver::GetInstance(), lock, VideoDriver::QueueOnMainThread(), RealMakeScreenshot(), and SC_CRASHLOG.
Referenced by MakeScreenshotWithConfirm(), ScreenshotConfirmationCallback(), and CrashLog::WriteScreenshot().
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 847 of file screenshot.cpp.
References _confirmed_screenshot_type, Viewport::height, MakeScreenshot(), SC_HEIGHTMAP, SC_MINIMAP, ScreenshotConfirmationCallback(), SetDParam(), SetupScreenshotViewport(), ShowQuery(), Map::SizeX(), Map::SizeY(), and Viewport::width.
Referenced by ScreenshotWindow::OnClick(), MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().
void SetupScreenshotViewport | ( | ScreenshotType | t, |
Viewport * | vp, | ||
uint32_t | width, | ||
uint32_t | 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 694 of file screenshot.cpp.
References _settings_client, _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, GetMainWindow(), ClientSettings::gui, Viewport::height, Viewport::left, RemapCoords(), SC_CRASHLOG, SC_VIEWPORT, SC_WORLD, SC_ZOOMEDIN, Map::Size(), TILE_SIZE, TilePixelHeight(), TileX(), TileXY(), TileY(), Viewport::top, UnScaleByZoom(), Window::viewport, Viewport::virtual_height, Viewport::virtual_left, Viewport::virtual_top, Viewport::virtual_width, Viewport::width, Viewport::zoom, ZOOM_LVL_VIEWPORT, ZOOM_LVL_WORLD_SCREENSHOT, and GUISettings::zoom_min.
Referenced by MakeLargeWorldScreenshot(), and MakeScreenshotWithConfirm().
|
extern |
Pathname of the screenshot file.
Definition at line 42 of file screenshot.cpp.
Referenced by MakeScreenshotName(), and CrashLog::WriteScreenshot().
|
extern |
Extension of the current screenshot format (corresponds with _cur_screenshot_format).
Definition at line 40 of file screenshot.cpp.
Referenced by InitializeScreenshotFormats().