5 // these defines and structures are for internal use only
6 // (ui_t is passed around by users of the system, but should not be altered)
7 #define MAX_UI_COUNT 16
8 #define MAX_UI_ITEMS 256
17 int click_x, click_y, click_x2, click_y2;
18 void(*leftkey)(void *nativedata1, void *nativedata2, float data1, float data2);
19 void(*rightkey)(void *nativedata1, void *nativedata2, float data1, float data2);
20 void(*enterkey)(void *nativedata1, void *nativedata2, float data1, float data2);
21 void(*mouseclick)(void *nativedata1, void *nativedata2, float data1, float data2, float xfrac, float yfrac);
22 void *nativedata1, *nativedata2;
31 ui_item_t items[MAX_UI_ITEMS];
36 // initializes the ui system
38 // updates the mouse position, given an absolute loation (some input systems use this)
39 void ui_mouseupdate(float x, float y);
40 // updates the mouse position, by an offset from the previous location (some input systems use this)
41 void ui_mouseupdaterelative(float x, float y);
43 void ui_leftkeyupdate(int pressed);
45 void ui_rightkeyupdate(int pressed);
47 void ui_upkeyupdate(int pressed);
49 void ui_downkeyupdate(int pressed);
50 // mouse button update (note: 0 = left, 1 = right, 2 = middle, 3+ not supported yet)
51 void ui_mousebuttonupdate(int button, int pressed);
52 // perform input updates and check for clicks on items (note: calls callbacks)
54 // draw all items of all panels
57 // intentionally public functions:
59 ui_t *ui_create(void);
61 void ui_free(ui_t *ui);
62 // empties a panel, removing all the items
63 void ui_clear(ui_t *ui);
64 // sets an item in a panel (adds or replaces the item)
67 ui_t *ui, char *basename, int number,
68 float x, float y, char *picname, char *string,
69 float left, float top, float width, float height,
70 void(*leftkey)(void *nativedata1, void *nativedata2, float data1, float data2),
71 void(*rightkey)(void *nativedata1, void *nativedata2, float data1, float data2),
72 void(*enterkey)(void *nativedata1, void *nativedata2, float data1, float data2),
73 void(*mouseclick)(void *nativedata1, void *nativedata2, float data1, float data2, float xfrac, float yfrac),
74 void *nativedata1, void *nativedata2, float data1, float data2
76 // removes an item from a panel
77 void ui_item_remove(ui_t *ui, char *basename, int number);
78 // checks if a panel is enabled
79 int ui_uiactive(ui_t *ui);
80 // enables/disables a panel on the screen
81 void ui_activate(ui_t *ui, int yes);