Translations update
[openttd/fttd.git] / src / viewport_type.h
blob3a9742c8162844daff64f22d6858b0a7ec1c5a2d
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file viewport_type.h Types related to viewports. */
12 #ifndef VIEWPORT_TYPE_H
13 #define VIEWPORT_TYPE_H
15 #include "zoom_type.h"
16 #include "strings_type.h"
17 #include "table/strings.h"
19 class LinkGraphOverlay;
21 /**
22 * Data structure for viewport, display of a part of the world
24 struct ViewPort {
25 int left; ///< Screen coordinate left egde of the viewport
26 int top; ///< Screen coordinate top edge of the viewport
27 int width; ///< Screen width of the viewport
28 int height; ///< Screen height of the viewport
30 int virtual_left; ///< Virtual left coordinate
31 int virtual_top; ///< Virtual top coordinate
32 int virtual_width; ///< width << zoom
33 int virtual_height; ///< height << zoom
35 ZoomLevel zoom; ///< The zoom level of the viewport.
36 LinkGraphOverlay *overlay;
39 /** Margins for the viewport sign */
40 enum ViewportSignMargin {
41 VPSM_LEFT = 1, ///< Left margin
42 VPSM_RIGHT = 1, ///< Right margin
43 VPSM_TOP = 1, ///< Top margin
44 VPSM_BOTTOM = 1, ///< Bottom margin
47 /** Location information about a sign as seen on the viewport */
48 struct ViewportSign {
49 int32 center; ///< The center position of the sign
50 int32 top; ///< The top of the sign
51 uint16 width_normal; ///< The width when not zoomed out (normal font)
52 uint16 width_small; ///< The width when zoomed out (small font)
54 void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
55 void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
58 /**
59 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
60 * z=0..5 Everything that can be built under low bridges.
61 * z=6 reserved, currently unused.
62 * z=7 Z separator between bridge/tunnel and the things under/above it.
64 static const uint BB_HEIGHT_UNDER_BRIDGE = 6; ///< Everything that can be built under low bridges, must not exceed this Z height.
65 static const uint BB_Z_SEPARATOR = 7; ///< Separates the bridge/tunnel from the things under/above it.
67 /** Viewport place method (type of highlighted area and placed objects) */
68 enum ViewportPlaceMethod {
69 VPM_NONE, ///< no selection currently in progress
70 VPM_X, ///< drag only in X axis
71 VPM_Y, ///< drag only in Y axis
72 VPM_X_AND_Y, ///< area of land in X and Y directions
73 VPM_X_AND_Y_ROTATED, ///< area of land, allow rotation
74 VPM_X_OR_Y, ///< drag in X or Y direction
75 VPM_RAILDIRS, ///< all rail directions
78 #endif /* VIEWPORT_TYPE_H */