20 #include "table/strings.h"
26 static constexpr
NWidgetPart _nested_extra_viewport_widgets[] = {
35 NWidget(
NWID_VIEWPORT, INVALID_COLOUR,
WID_EV_VIEWPORT),
SetPadding(2, 2, 2, 2),
SetResize(1, 1),
SetFill(1, 1),
42 SetDataTip(STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT),
44 SetDataTip(STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT),
64 void SetStringParameters(
WidgetID widget)
const override
74 void OnClick([[maybe_unused]]
Point pt,
WidgetID widget, [[maybe_unused]]
int click_count)
override
112 void OnScroll(
Point delta)
override
120 bool OnRightClick([[maybe_unused]]
Point pt,
WidgetID widget)
override
125 void OnMouseWheel(
int wheel)
override
128 ZoomInOrOutToCursorWindow(wheel < 0,
this);
137 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
139 if (!gui_scope)
return;
146 WDP_AUTO,
"extra_viewport", 300, 268,
149 _nested_extra_viewport_widgets
175 Point pt = GetTileBelowCursor();
Functions related to OTTD's landscape.
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
Zooms a viewport in a window in or out.
static debug_inline TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
A number of safeguards to prevent using unsafe methods.
ClientSettings _settings_client
The current settings for this game.
@ SWS_OFF
Scroll wheel has no effect.
This file contains all sprite-related enums and defines.
Definition of base types and functions in a cross-platform compatible way.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Functions related to OTTD's strings.
GUISettings gui
settings related to the GUI
ZoomLevel zoom_min
minimum zoom out level
uint8_t scrollwheel_scrolling
scrolling using the scroll wheel?
Coordinates of a point in 2D.
int32_t dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
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 viewp...
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).
ZoomLevel zoom
The zoom level of the viewport.
int virtual_width
width << zoom
int virtual_height
height << zoom
High level window description.
Data structure for an opened window.
void DisableWidget(WidgetID widget_index)
Sets a widget to disabled.
ViewportData * viewport
Pointer to viewport data, if present.
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
WindowNumber window_number
Window number within the window class.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
void HandleZoomMessage(Window *w, const Viewport *vp, WidgetID widget_zoom_in, WidgetID widget_zoom_out)
Update the status of the zoom-buttons according to the zoom-level of the viewport.
Functions related to (drawing on) viewports.
void ShowExtraViewportWindowForTileUnderCursor()
Show a new Extra Viewport window.
void ShowExtraViewportWindow(TileIndex tile)
Show a new Extra Viewport window.
@ ZOOM_IN
Zoom in (get more detailed view).
@ ZOOM_OUT
Zoom out (get helicopter view).
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Window * GetMainWindow()
Get the main window, i.e.
Window functions not directly related to making/drawing windows.
Functions, definitions and such used only by the GUI.
@ WDP_AUTO
Find a place automatically.
@ WC_EXTRA_VIEWPORT
Extra viewport; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Functions related to zooming.
int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_MIN) When shifting right,...
ZoomLevel ScaleZoomGUI(ZoomLevel value)
Scale zoom level relative to GUI zoom.
@ ZOOM_LVL_VIEWPORT
Default zoom level for viewports.