OpenTTD
viewport_type.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef VIEWPORT_TYPE_H
11 #define VIEWPORT_TYPE_H
12 
13 #include "zoom_type.h"
14 #include "strings_type.h"
15 #include "table/strings.h"
16 
17 class LinkGraphOverlay;
18 
22 struct ViewPort {
23  int left;
24  int top;
25  int width;
26  int height;
27 
32 
34  LinkGraphOverlay *overlay;
35 };
36 
39  VPSM_LEFT = 1,
40  VPSM_RIGHT = 1,
41  VPSM_TOP = 1,
43 };
44 
46 struct ViewportSign {
47  int32 center;
48  int32 top;
49  uint16 width_normal;
50  uint16 width_small;
51 
52  void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
53  void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
54 };
55 
58  bool kdtree_valid;
59 
64  void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL)
65  {
66  this->kdtree_valid = true;
67  this->ViewportSign::UpdatePosition(center, top, str, str_small);
68  }
69 
70 
71  TrackedViewportSign() : kdtree_valid{ false }
72  {
73  }
74 };
75 
81  ZOOM_IN = 0,
82  ZOOM_OUT = 1,
83  ZOOM_NONE = 2,
84 };
85 
92 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
93 static const uint BB_Z_SEPARATOR = 7;
94 
97  VPM_X_OR_Y = 0,
98  VPM_FIX_X = 1,
99  VPM_FIX_Y = 2,
106  VPM_RAILDIRS = 0x40,
107  VPM_SIGNALDIRS = 0x80,
108 };
110 
111 
126 
127  /* Rail specific actions */
133 
134  /* Road specific actions */
143 };
144 
145 
153 };
154 
155 #endif /* VIEWPORT_TYPE_H */
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you&#39;ve selected it...
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
int virtual_left
Virtual left coordinate.
Definition: viewport_type.h:28
Station placement.
area of land of limited size
Raise / level area.
Road stop placement (trucks)
Zoom out (get helicopter view).
Definition: viewport_type.h:82
int height
Screen height of the viewport.
Definition: viewport_type.h:26
Road stop removal (trucks)
Lower / level area.
drag only in X axis
Definition: viewport_type.h:98
static const uint BB_Z_SEPARATOR
Separates the bridge/tunnel from the things under/above it.
Definition: viewport_type.h:93
Drag only in X axis with limited size.
similar to VMP_RAILDIRS, but with different cursor
drag only in Y axis
Definition: viewport_type.h:99
Drag only in Y axis with limited size.
int virtual_height
height << zoom
Definition: viewport_type.h:31
void UpdatePosition(int center, int top, StringID str, StringID str_small=STR_NULL)
Update the position of the viewport sign.
Definition: viewport_type.h:64
Zoom in (get more detailed view).
Definition: viewport_type.h:81
Road stop removal (buses)
All players.
void UpdatePosition(int center, int top, StringID str, StringID str_small=STR_NULL)
Update the position of the viewport sign.
Definition: viewport.cpp:1442
Maximum zoom level.
Definition: zoom_type.h:46
Left margin.
Definition: viewport_type.h:39
ViewportScrollTarget
Target of the viewport scrolling GS method.
Right margin.
Definition: viewport_type.h:40
Types related to zooming in and out.
Fill area with rocks.
Specialised ViewportSign that tracks whether it is valid for entering into a Kdtree.
Definition: viewport_type.h:57
Road placement (X axis)
Plant trees.
Signal placement.
int32 top
The top of the sign.
Definition: viewport_type.h:48
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:96
drag in X or Y direction
Definition: viewport_type.h:97
Location information about a sign as seen on the viewport.
Definition: viewport_type.h:46
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
Definition: viewport_type.h:92
Road stop placement (buses)
Station removal.
Single player.
uint16 width_normal
The width when not zoomed out (normal font)
Definition: viewport_type.h:49
int virtual_width
width << zoom
Definition: viewport_type.h:30
Create rivers.
Bridge placement.
Create a canal.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
drag only in horizontal direction
Road placement (auto)
Rail placement.
int32 center
The center position of the sign.
Definition: viewport_type.h:47
int left
Screen coordinate left edge of the viewport.
Definition: viewport_type.h:23
Fill area with desert.
area of land in X and Y directions
Bottom margin.
Definition: viewport_type.h:42
Data structure for viewport, display of a part of the world.
Definition: viewport_type.h:22
Rail conversion.
All players in specific company.
ViewportSignMargin
Margins for the viewport sign.
Definition: viewport_type.h:38
Top margin.
Definition: viewport_type.h:41
Types related to strings.
drag only in vertical direction
Road placement (Y axis)
ZoomLevel zoom
The zoom level of the viewport.
Definition: viewport_type.h:33
ZoomStateChange
Directions of zooming.
Definition: viewport_type.h:80
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:19
int virtual_top
Virtual top coordinate.
Definition: viewport_type.h:29
uint16 width_small
The width when zoomed out (small font)
Definition: viewport_type.h:50
all rail directions
int top
Screen coordinate top edge of the viewport.
Definition: viewport_type.h:24
Level area.
bool kdtree_valid
Are the sign data valid for use with the _viewport_sign_kdtree?
Definition: viewport_type.h:58
Hack, used to update the button status.
Definition: viewport_type.h:83
Handles drawing of links into some window.
Definition: linkgraph_gui.h:37
Road conversion.
int width
Screen width of the viewport.
Definition: viewport_type.h:25