OpenTTD: src/screenshot.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Enumerations | Functions | Variables
screenshot.h File Reference

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 }
| 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.
bool | MakeHeightmapScreenshot (const char *filename)
| Make a heightmap of the current map.
bool | MakeScreenshot (ScreenshotType t, const char *name)
| Make an actual 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

enum 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.

Definition at line 20 of file screenshot.h.

## Function Documentation

const char* GetCurrentScreenshotExtension | ( |  | ) |

Get filename extension of current screenshot file format.

Definition at line 581 of file screenshot.cpp.

References _cur_screenshot_format, and 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 587 of file screenshot.cpp.

References _cur_screenshot_format, _num_screenshot_formats, _screenshot_format_name, and lengthof.

Referenced by openttd_main().

bool MakeHeightmapScreenshot | ( | const char * | filename | ) |

Make a heightmap of the current map.

Parameters

  filename | Filename to use for saving.

Definition at line 800 of file screenshot.cpp.

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

Referenced by MakeScreenshot().

bool MakeScreenshot | ( | ScreenshotType | t,
|  | const char * | name
| ) |  |

Make an actual screenshot.

Parameters

  t | the type of screenshot to make.
  name | the name to give to the screenshot.

Returns
  true iff the screenshot was made successfully

Definition at line 819 of file screenshot.cpp.

References _cur_screenshot_format, _screenshot_name, DrawDirtyBlocks(), ScreenshotFormat::extension, HEIGHTMAP_NAME, INVALID_STRING_ID, lastof, MakeHeightmapScreenshot(), MakeLargeWorldScreenshot(), MakeScreenshotName(), MakeSmallScreenshot(), SC_CRASHLOG, SC_DEFAULTZOOM, SC_HEIGHTMAP, SC_VIEWPORT, SC_WORLD, SC_ZOOMEDIN, SetDParamStr(), ShowErrorMessage(), strecpy(), WL_ERROR, and WL_WARNING.

Referenced by MenuClickLargeWorldScreenshot(), ScreenshotConfirmCallback(), and CrashLog::WriteScreenshot().

void SetupScreenshotViewport | ( | ScreenshotType | t,
|  | ViewPort * | vp
| ) |  |

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

Parameters

  | t | Screenshot type
  [out] | vp | Result viewport

Definition at line 720 of file screenshot.cpp.

References _settings_client, _settings_game, GameSettings::construction, FindWindowById(), ConstructionSettings::freeform_edges, ClientSettings::gui, ViewPort::height, ViewPort::left, MapSize(), RemapCoords(), SC_WORLD, SC_ZOOMEDIN, TILE_SIZE, TilePixelHeight(), TileX(), TileXY(), TileY(), ViewPort::top, UnScaleByZoom(), ViewPort::virtual_height, ViewPort::virtual_left, ViewPort::virtual_top, ViewPort::virtual_width, WC_MAIN_WINDOW, ViewPort::width, ViewPort::zoom, ZOOM_LVL_VIEWPORT, ZOOM_LVL_WORLD_SCREENSHOT, and GUISettings::zoom_min.

Referenced by MakeLargeWorldScreenshot(), and MenuClickLargeWorldScreenshot().