Fix most warnings.
[runemen.git] / src / ui.h
blobc03aeb7b7a53a8c44183723911f854d93cb60f5e
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 overUnitPin,
42 overUnitStat,
43 overUnitSkill,
44 overUnitName,
46 overFlagButton,
47 overBuildButton,
49 } uiHoverMinor;
51 typedef struct ui_t ui_t;
52 struct ui_t {
53 int x; /* cursor position */
54 int y;
56 int vx; /* viewport offset (scrolling) */
57 int vy;
59 int flingx; /* desired viewport offset (for scrolling) */
60 int flingy;
62 int dragging; /* dragging with touch/middle button */
63 int pushing; /* holding the button/finger down */
65 int unit; /* selected unit */
66 int house; /* selected building */
67 int flag; /* selected flag */
68 int builder;/* building to build */
69 int setflag;/* flag to place */
70 int stat; /* selected stat */
71 int btn; /* ??? */
73 int hintType;
74 int hint;
76 uiHoverMajor hover_top;
77 uiHoverMinor hover;
78 int hover_id;
79 int hover_xcollide;
80 int hover_tx;
81 int hover_ty;
83 int no_mouse; /* for touch devices */
84 int log_width; /* can't rely on DEFINES */
85 int log_height;
87 int freq; /* just a counter, always ++ */
89 /* layers */
90 int draw_minimap;
91 int draw_uibg;
92 int draw_fog;
93 int draw_path;
94 int draw_pools;
95 int draw_overlays;
96 int draw_scent;
97 int draw_log;
99 /* debug */
100 int game_speed;
101 int fps;
104 /* Externals */
105 extern int find_unit(Uint32 x, Uint32 y);
106 extern int find_house(Uint32 x, Uint32 y);
108 /** **/
110 extern ui_t ui;
111 extern SDL_Rect minimap;
112 extern SDL_Rect buildbox;
113 extern SDL_Rect selbox;
114 extern SDL_Rect pinbox;
115 extern SDL_Rect hintbox;
117 extern SDL_Rect unitpin;
118 extern SDL_Rect plusbtn;
120 extern SDL_Rect top_pane;
121 extern SDL_Rect ui_pane;
122 extern SDL_Rect game_map;
124 /** **/
126 extern void init_ui(SDL_Renderer *renderer, int w, int h);
128 extern void reset_ui();
130 extern void track_mouse();
131 extern void track_mouse_map();
132 extern void track_mouse_ui();
134 #endif