OpenTTD Source  1.11.0-beta2
screenshot.h File Reference

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)
 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, const char *name)
 Make 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.
 

Detailed Description

Functions to make screenshots.

Definition in file screenshot.h.

Enumeration Type Documentation

◆ ScreenshotType

Type of requested screenshot.

Enumerator
SC_VIEWPORT 

Screenshot of viewport.

SC_CRASHLOG 

Raw screenshot from blitter buffer.

SC_ZOOMEDIN 

Fully zoomed in screenshot of the visible area.

SC_DEFAULTZOOM 

Zoomed to default zoom level screenshot of the visible area.

SC_WORLD 

World screenshot.

SC_HEIGHTMAP 

Heightmap of the world.

SC_MINIMAP 

Minimap screenshot.

Definition at line 18 of file screenshot.h.

Function Documentation

◆ MakeHeightmapScreenshot()

bool MakeHeightmapScreenshot ( const char *  filename)

Make a heightmap of the current map.

Parameters
filenameFilename to use for saving.

Definition at line 823 of file screenshot.cpp.

References _cur_screenshot_format, _screenshot_formats, Colour::a, HeightmapCallback(), lengthof, MapSizeX(), MapSizeY(), and ScreenshotFormat::proc.

◆ MakeScreenshot()

bool MakeScreenshot ( ScreenshotType  t,
const char *  name 
)

Make a screenshot.

Unconditionally take a screenshot of the requested type.

Parameters
tthe type of screenshot to make.
namethe name to give to the screenshot.
Returns
true iff the screenshot was made successfully
See also
MakeScreenshotWithConfirm

Definition at line 883 of file screenshot.cpp.

References lock, and SC_VIEWPORT.

Referenced by MakeScreenshotWithConfirm(), and ScreenshotConfirmationCallback().

◆ MakeScreenshotWithConfirm()

void MakeScreenshotWithConfirm ( ScreenshotType  t)

Make a screenshot.

Ask for confirmation first if the screenshot will be huge.

Parameters
tScreenshot type: World, defaultzoom, heightmap or viewport screenshot
See also
MakeScreenshot

Definition at line 854 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().

◆ SetupScreenshotViewport()

void SetupScreenshotViewport ( ScreenshotType  t,
Viewport vp 
)

Configure a Viewport for rendering (a part of) the map into a screenshot.

Parameters
tScreenshot type
[out]vpResult viewport

Definition at line 715 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().