OpenTTD Source  20241108-master-g80f628063a
ViewportData Struct Reference

Data structure for a window viewport. More...

#include <window_gui.h>

Inheritance diagram for ViewportData:
Viewport

Data Fields

VehicleID follow_vehicle
 VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
 
int32_t scrollpos_x
 Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
 
int32_t scrollpos_y
 Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
 
int32_t dest_scrollpos_x
 Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewport).
 
int32_t dest_scrollpos_y
 Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewport).
 
- Data Fields inherited from Viewport
int left
 Screen coordinate left edge of the viewport.
 
int top
 Screen coordinate top edge of the viewport.
 
int width
 Screen width of the viewport.
 
int height
 Screen height of the viewport.
 
int virtual_left
 Virtual left coordinate.
 
int virtual_top
 Virtual top coordinate.
 
int virtual_width
 width << zoom
 
int virtual_height
 height << zoom
 
ZoomLevel zoom
 The zoom level of the viewport.
 
std::shared_ptr< LinkGraphOverlayoverlay
 

Detailed Description

Data structure for a window viewport.

A viewport is either following a vehicle (its id in then in follow_vehicle), or it aims to display a specific location dest_scrollpos_x, dest_scrollpos_y (follow_vehicle is then INVALID_VEHICLE). The actual location being shown is scrollpos_x, scrollpos_y.

See also
InitializeViewport(), UpdateViewportPosition(), UpdateViewportCoordinates().

Definition at line 252 of file window_gui.h.


The documentation for this struct was generated from the following file: