author | tron |
Mon, 15 Nov 2004 19:25:59 +0000 | |
changeset 430 | 75820dedf4f1 |
parent 193 | 0a7025304867 |
child 513 | 6d5272e230c6 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef VIEWPORT_H |
2 |
#define VIEWPORT_H |
|
3 |
||
4 |
struct ViewPort { |
|
5 |
int left,top; // screen coordinates for the viewport |
|
6 |
int width, height; // screen width/height for the viewport |
|
7 |
||
8 |
int virtual_left, virtual_top; // virtual coordinates |
|
9 |
int virtual_width, virtual_height; // these are just width << zoom, height << zoom |
|
10 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
152
diff
changeset
|
11 |
byte zoom; |
0 | 12 |
}; |
13 |
||
14 |
/* viewport.c */ |
|
15 |
Point MapXYZToViewport(ViewPort *vp, uint x, uint y, uint z); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
152
diff
changeset
|
16 |
void AssignWindowViewport(Window *w, int x, int y, |
0 | 17 |
int width, int height, uint32 follow_flags, byte zoom); |
18 |
void SetViewportPosition(Window *w, int x, int y); |
|
19 |
ViewPort *IsPtInWindowViewport(Window *w, int x, int y); |
|
20 |
Point GetTileBelowCursor(); |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
133
diff
changeset
|
21 |
void ZoomInOrOutToCursorWindow(bool in, Window * w); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
133
diff
changeset
|
22 |
Point GetTileZoomCenterWindow(bool in, Window * w); |
0 | 23 |
void UpdateViewportPosition(Window *w); |
24 |
||
25 |
void OffsetGroundSprite(int x, int y); |
|
26 |
||
27 |
void DrawGroundSprite(uint32 image); |
|
133
321532e90bc8
(svn r134) -Fix: [976583] parent_list was too small
truelight
parents:
58
diff
changeset
|
28 |
void DrawGroundSpriteAt(uint32 image, int16 x, int16 y, byte z); |
0 | 29 |
void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz, byte z); |
30 |
void *AddStringToDraw(int x, int y, StringID string, uint32 params_1, uint32 params_2); |
|
31 |
void AddChildSpriteScreen(uint32 image, int x, int y); |
|
32 |
||
33 |
||
34 |
void StartSpriteCombine(); |
|
35 |
void EndSpriteCombine(); |
|
36 |
||
37 |
void HandleViewportClicked(ViewPort *vp, int x, int y); |
|
38 |
void PlaceObject(); |
|
39 |
void SetRedErrorSquare(TileIndex tile); |
|
40 |
void SetTileSelectSize(int w, int h); |
|
41 |
void SetTileSelectBigSize(int ox, int oy, int sx, int sy); |
|
42 |
||
43 |
void VpStartPlaceSizing(uint tile, int user); |
|
44 |
void VpStartPreSizing(); |
|
45 |
void VpSetPresizeRange(uint from, uint to); |
|
46 |
void VpSetPlaceSizingLimit(int limit); |
|
47 |
||
48 |
Vehicle *CheckMouseOverVehicle(); |
|
49 |
||
50 |
enum { |
|
51 |
VPM_X_OR_Y = 0, |
|
52 |
VPM_FIX_X = 1, |
|
53 |
VPM_FIX_Y = 2, |
|
54 |
VPM_RAILDIRS = 3, |
|
55 |
VPM_X_AND_Y = 4, |
|
56 |
VPM_X_AND_Y_LIMITED = 5, |
|
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
57 |
VPM_SIGNALDIRS = 6, |
0 | 58 |
}; |
59 |
||
60 |
void VpSelectTilesWithMethod(int x, int y, int method); |
|
61 |
||
62 |
enum { |
|
63 |
HT_NONE = 0, |
|
64 |
HT_RECT = 0x80, |
|
65 |
HT_POINT = 0x40, |
|
66 |
HT_LINE = 0x20, |
|
67 |
}; |
|
68 |
||
69 |
typedef struct TileHighlightData { |
|
70 |
Point size; |
|
71 |
Point outersize; |
|
72 |
Point pos; |
|
73 |
Point offs; |
|
74 |
||
75 |
Point new_pos; |
|
76 |
Point new_size; |
|
77 |
Point new_outersize; |
|
78 |
||
79 |
Point selend, selstart; |
|
80 |
||
81 |
byte dirty; |
|
82 |
byte sizelimit; |
|
83 |
||
84 |
byte drawstyle; |
|
85 |
byte new_drawstyle; |
|
86 |
byte next_drawstyle; |
|
87 |
||
88 |
byte place_mode; |
|
89 |
byte window_class; |
|
90 |
bool make_square_red; |
|
91 |
uint16 window_number; |
|
92 |
||
93 |
int userdata; |
|
94 |
TileIndex redsq; |
|
95 |
} TileHighlightData; |
|
96 |
||
97 |
||
98 |
enum AnimCursors { |
|
99 |
ANIMCURSOR_DEMOLISH = -1, |
|
100 |
ANIMCURSOR_LOWERLAND = -2, |
|
101 |
ANIMCURSOR_RAISELAND = -3, |
|
102 |
ANIMCURSOR_PICKSTATION = -4, |
|
103 |
ANIMCURSOR_BUILDSIGNALS = -5, |
|
104 |
}; |
|
105 |
||
106 |
// common button handler |
|
107 |
bool HandlePlacePushButton(Window *w, int widget, uint32 cursor, int mode, PlaceProc *placeproc); |
|
108 |
||
109 |
/* viewport.c */ |
|
110 |
VARDEF ViewPort _viewports[18]; |
|
111 |
VARDEF TileHighlightData _thd; |
|
112 |
VARDEF uint32 _active_viewports; |
|
113 |
||
114 |
VARDEF Point _tile_fract_coords; |
|
115 |
||
116 |
extern TileHighlightData * const _thd_ptr; |
|
117 |
||
118 |
||
430 | 119 |
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom); |
120 |
||
121 |
#endif /* VIEWPORT_H */ |