ddnet/src/game/client/gc_ui.hpp

66 lines
1.9 KiB
C++
Raw Normal View History

2007-11-25 19:42:40 +00:00
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
2007-05-22 15:03:32 +00:00
#ifndef _UI_H
#define _UI_H
2008-01-12 12:27:55 +00:00
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
};
2007-05-22 15:03:32 +00:00
int ui_update(float mx, float my, float mwx, float mwy, int buttons);
float ui_mouse_x();
float ui_mouse_y();
float ui_mouse_world_x();
float ui_mouse_world_y();
int ui_mouse_button(int index);
2008-01-12 12:27:55 +00:00
int ui_mouse_button_clicked(int index);
2007-05-22 15:03:32 +00:00
2007-11-04 21:36:03 +00:00
void ui_set_hot_item(const void *id);
void ui_set_active_item(const void *id);
2007-07-21 16:33:01 +00:00
void ui_clear_last_active_item();
2007-11-04 21:36:03 +00:00
const void *ui_hot_item();
2008-01-13 22:03:32 +00:00
const void *ui_next_hot_item();
2007-11-04 21:36:03 +00:00
const void *ui_active_item();
const void *ui_last_active_item();
2007-05-22 15:03:32 +00:00
2008-01-12 12:27:55 +00:00
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);
2007-05-22 15:03:32 +00:00
2008-01-12 12:27:55 +00:00
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);
2008-01-12 15:07:57 +00:00
void ui_do_label(const RECT *r, const char *text, float size, int align, int max_width = -1);
2007-05-22 15:03:32 +00:00
#endif