author | rubidium |
Mon, 07 Apr 2008 20:28:58 +0000 | |
changeset 10083 | 9fb63cf5cc90 |
parent 8721 | b7971ad9bdd9 |
child 10445 | 2dd7d9d0a957 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
3 |
/** @file viewport_type.h Types related to viewports. */ |
6919
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
4 |
|
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
5 |
#ifndef VIEWPORT_TYPE_H |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
6 |
#define VIEWPORT_TYPE_H |
0 | 7 |
|
8721
b7971ad9bdd9
(svn r11788) -Fix (11787): makedepend doesn't mark delete files as changed...
rubidium
parents:
8720
diff
changeset
|
8 |
#include "core/geometry_type.hpp" |
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8617
diff
changeset
|
9 |
#include "zoom_type.h" |
8602
9e75e594a068
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents:
8414
diff
changeset
|
10 |
#include "window_type.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
11 |
#include "tile_type.h" |
7120
e31767effc16
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6919
diff
changeset
|
12 |
|
10083
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
13 |
/** |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
14 |
* Data structure for viewport, display of a part of the world |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
15 |
*/ |
0 | 16 |
struct ViewPort { |
10083
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
17 |
int left; ///< Screen coordinate left egde of the viewport |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
18 |
int top; ///< Screen coordinate top edge of the viewport |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
19 |
int width; ///< Screen width of the viewport |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
20 |
int height; ///< Screen height of the viewport |
0 | 21 |
|
10083
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
22 |
int virtual_left; ///< Virtual left coordinate |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
23 |
int virtual_top; ///< Virtual top coordinate |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
24 |
int virtual_width; ///< width << zoom |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
25 |
int virtual_height; ///< height << zoom |
0 | 26 |
|
7120
e31767effc16
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6919
diff
changeset
|
27 |
ZoomLevel zoom; |
0 | 28 |
}; |
29 |
||
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
30 |
enum { |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
31 |
ZOOM_IN = 0, |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
32 |
ZOOM_OUT = 1, |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
33 |
ZOOM_NONE = 2, // hack, used to update the button status |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
34 |
}; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5026
diff
changeset
|
35 |
|
8097
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
36 |
/** |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
37 |
* Some values for constructing bounding boxes (BB). The Z positions under bridges are: |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
38 |
* z=0..5 Everything that can be built under low bridges. |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
39 |
* z=6 reserved, currently unused. |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
40 |
* z=7 Z separator between bridge/tunnel and the things under/above it. |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
41 |
*/ |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
42 |
enum { |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
43 |
BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height. |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
44 |
BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it. |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
45 |
}; |
68eefbb4ff46
(svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents:
8076
diff
changeset
|
46 |
|
8384
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
47 |
/** Viewport place method (type of highlighted area and placed objects) */ |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
48 |
enum ViewportPlaceMethod { |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
49 |
VPM_X_OR_Y = 0, ///< drag in X or Y direction |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
50 |
VPM_FIX_X = 1, ///< drag only in X axis |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
51 |
VPM_FIX_Y = 2, ///< drag only in Y axis |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
52 |
VPM_RAILDIRS = 3, ///< all rail directions |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
53 |
VPM_X_AND_Y = 4, ///< area of land in X and Y directions |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
54 |
VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size |
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
55 |
VPM_SIGNALDIRS = 6, ///< similiar to VMP_RAILDIRS, but with different cursor |
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
56 |
}; |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
57 |
|
8414
8c2ecc2dc12c
(svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents:
8385
diff
changeset
|
58 |
/** Viewport highlight mode (for highlighting tiles below cursor) */ |
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8384
diff
changeset
|
59 |
enum ViewportHighlightMode { |
6919
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
60 |
VHM_NONE = 0, ///< default |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
61 |
VHM_RECT = 1, ///< rectangle (stations, depots, ...) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
62 |
VHM_POINT = 2, ///< point (lower land, raise land, level land, ...) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
63 |
VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
64 |
VHM_DRAG = 4, ///< dragging items in the depot windows |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
65 |
VHM_RAIL = 5, ///< rail pieces |
0 | 66 |
}; |
67 |
||
10083
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8721
diff
changeset
|
68 |
/** Highlighting draw styles */ |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
69 |
enum HighLightStyle { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
2817
diff
changeset
|
70 |
HT_NONE = 0x00, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
2817
diff
changeset
|
71 |
HT_RECT = 0x80, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
2817
diff
changeset
|
72 |
HT_POINT = 0x40, |
6919
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
73 |
HT_LINE = 0x20, ///< used for autorail highlighting (longer streches) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
74 |
///< (uses lower bits to indicate direction) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
75 |
HT_RAIL = 0x10, ///< autorail (one piece) |
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6574
diff
changeset
|
76 |
///< (uses lower bits to indicate direction) |
4799
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
77 |
HT_DRAG_MASK = 0xF0, ///< masks the drag-type |
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
78 |
|
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
79 |
/* lower bits (used with HT_LINE and HT_RAIL): |
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
80 |
* (see ASCII art in autorail.h for a visual interpretation) */ |
4799
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
81 |
HT_DIR_X = 0, ///< X direction |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
82 |
HT_DIR_Y = 1, ///< Y direction |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
83 |
HT_DIR_HU = 2, ///< horizontal upper |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
84 |
HT_DIR_HL = 3, ///< horizontal lower |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
85 |
HT_DIR_VL = 4, ///< vertical left |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
86 |
HT_DIR_VR = 5, ///< vertical right |
a32af5dd7b6c
(svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents:
4344
diff
changeset
|
87 |
HT_DIR_MASK = 0x7 ///< masks the drag-direction |
0 | 88 |
}; |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
89 |
DECLARE_ENUM_AS_BIT_SET(HighLightStyle); |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
90 |
|
0 | 91 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
92 |
struct TileHighlightData { |
0 | 93 |
Point size; |
94 |
Point outersize; |
|
95 |
Point pos; |
|
96 |
Point offs; |
|
97 |
||
98 |
Point new_pos; |
|
99 |
Point new_size; |
|
100 |
Point new_outersize; |
|
101 |
||
102 |
Point selend, selstart; |
|
103 |
||
104 |
byte dirty; |
|
105 |
byte sizelimit; |
|
106 |
||
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
107 |
byte drawstyle; // lower bits 0-3 are reserved for detailed highlight information information |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
108 |
byte new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
873
diff
changeset
|
109 |
byte next_drawstyle; // queued, but not yet drawn style |
0 | 110 |
|
8414
8c2ecc2dc12c
(svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents:
8385
diff
changeset
|
111 |
ViewportHighlightMode place_mode; |
0 | 112 |
bool make_square_red; |
873
46e892485be3
(svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents:
849
diff
changeset
|
113 |
WindowClass window_class; |
46e892485be3
(svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents:
849
diff
changeset
|
114 |
WindowNumber window_number; |
0 | 115 |
|
8384
cda01fb6ec2a
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
8177
diff
changeset
|
116 |
ViewportPlaceMethod select_method; |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7120
diff
changeset
|
117 |
byte select_proc; |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7120
diff
changeset
|
118 |
|
0 | 119 |
TileIndex redsq; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
120 |
}; |
0 | 121 |
|
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8634
diff
changeset
|
122 |
#endif /* VIEWPORT_TYPE_H */ |