OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
20 #include "table/strings.h"
26 static const 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),
140 ZoomInOrOutToCursorWindow(wheel < 0,
this);
151 if (!gui_scope)
return;
158 WDP_AUTO,
"extra_viewport", 300, 268,
161 _nested_extra_viewport_widgets,
lengthof(_nested_extra_viewport_widgets)
187 Point pt = GetTileBelowCursor();
uint32 TileIndex
The index/ID of a Tile.
@ ZOOM_OUT
Zoom out (get helicopter view).
static uint TilePixelHeight(TileIndex tile)
Returns the height of a tile in pixels.
static Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap.
ViewportData * viewport
Pointer to viewport data, if present.
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
Zooms a viewport in a window in or out.
static const uint TILE_SIZE
Tile size in world coordinates.
ClientSettings _settings_client
The current settings for this game.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
static uint TileX(TileIndex tile)
Get the X component of a tile.
High level window description.
@ ZOOM_IN
Zoom in (get more detailed view).
uint8 scrollwheel_scrolling
scrolling using the scroll wheel?
@ WDP_AUTO
Find a place automatically.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
int virtual_width
width << zoom
Coordinates of a point in 2D.
@ WC_EXTRA_VIEWPORT
Extra viewport; Window numbers:
int32 dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
@ ZOOM_LVL_VIEWPORT
Default zoom level for viewports.
WindowNumber window_number
Window number within the window class.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
ZoomLevel zoom_min
minimum zoom out level
void ShowExtraViewportWindowForTileUnderCursor()
Show a new Extra Viewport window.
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
static int ScaleByZoom(int value, ZoomLevel zoom)
Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right,...
@ WC_MAIN_WINDOW
Main window; Window numbers:
VehicleID follow_vehicle
VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
#define lengthof(x)
Return the length of an fixed size array.
int32 dest_scrollpos_x
Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewp...
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Data structure for an opened window.
int virtual_height
height << zoom
void HandleZoomMessage(Window *w, const Viewport *vp, byte widget_zoom_in, byte widget_zoom_out)
Update the status of the zoom-buttons according to the zoom-level of the viewport.
void DisableWidget(byte widget_index)
Sets a widget to disabled.
GUISettings gui
settings related to the GUI
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
void ShowExtraViewportWindow(TileIndex tile)
Show a new Extra Viewport window.