diff options
Diffstat (limited to 'src/engine/client/ec_ui.h')
| -rw-r--r-- | src/engine/client/ec_ui.h | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/src/engine/client/ec_ui.h b/src/engine/client/ec_ui.h index 15c63b90..83dbe37d 100644 --- a/src/engine/client/ec_ui.h +++ b/src/engine/client/ec_ui.h @@ -6,6 +6,28 @@ extern "C" { #endif + + +typedef struct +{ + float x, y, w, h; +} RECT; + +enum +{ + CORNER_TL=1, + CORNER_TR=2, + CORNER_BL=4, + CORNER_BR=8, + + CORNER_T=CORNER_TL|CORNER_TR, + CORNER_B=CORNER_BL|CORNER_BR, + CORNER_R=CORNER_TR|CORNER_BR, + CORNER_L=CORNER_TL|CORNER_BL, + + CORNER_ALL=CORNER_T|CORNER_B +}; + int ui_update(float mx, float my, float mwx, float mwy, int buttons); float ui_mouse_x(); @@ -13,6 +35,7 @@ float ui_mouse_y(); float ui_mouse_world_x(); float ui_mouse_world_y(); int ui_mouse_button(int index); +int ui_mouse_button_clicked(int index); void ui_set_hot_item(const void *id); void ui_set_active_item(const void *id); @@ -21,13 +44,28 @@ const void *ui_hot_item(); const void *ui_active_item(); const void *ui_last_active_item(); -int ui_mouse_inside(float x, float y, float w, float h); +int ui_mouse_inside(const RECT *r); + +RECT *ui_screen(); +void ui_set_scale(float s); +float ui_scale(); +void ui_clip_enable(const RECT *r); +void ui_clip_disable(); + +void ui_hsplit_t(const RECT *original, float cut, RECT *top, RECT *bottom); +void ui_hsplit_b(const RECT *original, float cut, RECT *top, RECT *bottom); +void ui_vsplit_mid(const RECT *original, RECT *left, RECT *right); +void ui_vsplit_l(const RECT *original, float cut, RECT *left, RECT *right); +void ui_vsplit_r(const RECT *original, float cut, RECT *left, RECT *right); + +void ui_margin(const RECT *original, float cut, RECT *other_rect); +void ui_vmargin(const RECT *original, float cut, RECT *other_rect); +void ui_hmargin(const RECT *original, float cut, RECT *other_rect); -typedef void (*draw_button_callback)(const void *id, const char *text, int checked, float x, float y, float w, float h, void *extra); +typedef void (*ui_draw_button_func)(const void *id, const char *text, int checked, const RECT *r, const void *extra); +int ui_do_button(const void *id, const char *text, int checked, const RECT *r, ui_draw_button_func draw_func, const void *extra); +void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width); -void ui_do_image(int texture, float x, float y, float w, float h); -void ui_do_label(float x, float y, const char *text, float size); -int ui_do_button(const void *id, const char *text, int checked, float x, float y, float w, float h, draw_button_callback draw_func, void *extra); #ifdef __cplusplus } |