Add unit and house tabs, flag button.
[runemen.git] / src / ui.h
blobcb3cbca57c843147da2d61d918c0f6ee8b808492
1 #ifndef _RUNE_UI_H
2 #define _RUNE_UI_H
4 #include <SDL.h>
6 #define PANE_WIDTH (128+10)
8 #define MINIMAP_PADDING 1
10 #define BOX_PADDING 4
12 #define SDL_InBounds(X, Y, RECT) \
13 ((X) >= (RECT)->x && (X) <= (RECT)->x + (RECT)->w && \
14 (Y) >= (RECT)->y && (Y) <= (RECT)->y + (RECT)->h)
17 typedef enum uiHoverMajor {
18 overNothingMajor,
19 overMap,
20 overPane,
21 } uiHoverMajor;
23 typedef enum uiHoverMinor {
25 overNothingMinor,
27 overUnit,
28 overHouse,
29 overFlag,
31 overMinimap,
32 overUnitBox,
33 overHouseBox,
34 overPinBox,
36 overListName,
37 overListPin,
39 overFlagPlus,
41 overUnitTab,
42 overUnitPin,
43 overUnitFlag,
44 overUnitStat,
45 overUnitSkill,
46 overUnitName,
48 overHouseTab,
49 overHouseFlag,
51 overFlagButton,
52 overBuildButton,
54 } uiHoverMinor;
56 typedef struct ui_t ui_t;
57 struct ui_t {
58 int x; /* cursor position */
59 int y;
61 int vx; /* viewport offset (scrolling) */
62 int vy;
64 int flingx; /* desired viewport offset (for scrolling) */
65 int flingy;
67 int dragging; /* dragging with touch/middle button */
68 int pushing; /* holding the button/finger down */
70 int unit; /* selected unit */
71 int house; /* selected building */
72 int flag; /* selected flag */
73 int builder;/* building to build */
74 int setflag;/* flag to place */
75 int stat; /* selected stat */
76 int btn; /* ??? */
77 int unittab;/* selected unit tab */
78 int housetab;/* selected house tab */
80 int hintType;
81 int hint;
83 uiHoverMajor hover_top;
84 uiHoverMinor hover;
85 int hover_id;
86 int hover_xcollide;
87 int hover_tx;
88 int hover_ty;
90 int no_mouse; /* for touch devices */
91 int log_width; /* can't rely on DEFINES */
92 int log_height;
94 int freq; /* just a counter, always ++ */
96 /* layers */
97 int draw_minimap;
98 int draw_uibg;
99 int draw_fog;
100 int draw_path;
101 int draw_pools;
102 int draw_overlays;
103 int draw_scent;
104 int draw_log;
106 /* debug */
107 int game_speed;
108 int fps;
111 /* Externals */
112 extern int find_unit(Uint32 x, Uint32 y);
113 extern int find_house(Uint32 x, Uint32 y);
115 /** **/
117 extern ui_t ui;
118 extern SDL_Rect minimap;
119 extern SDL_Rect buildbox;
120 extern SDL_Rect selbox;
121 extern SDL_Rect pinbox;
122 extern SDL_Rect hintbox;
124 extern SDL_Rect tabicon;
125 extern SDL_Rect unitpin;
126 extern SDL_Rect flagicon;
127 extern SDL_Rect plusbtn;
129 extern SDL_Rect top_pane;
130 extern SDL_Rect ui_pane;
131 extern SDL_Rect game_map;
133 /** **/
135 extern void init_ui(SDL_Renderer *renderer, int w, int h);
137 extern void reset_ui();
139 extern void track_mouse();
140 extern void track_mouse_map();
141 extern void track_mouse_ui();
143 #endif