rect_top and children sum

This commit is contained in:
Krzosa Karol
2025-01-28 23:26:46 +01:00
parent 5fe358f480
commit 491f60b59e
6 changed files with 113 additions and 71 deletions

View File

@@ -17,6 +17,8 @@ struct ui_box_flags_t {
b8 draw_text: 1;
b8 clip_rect: 1;
b8 children_sum_x: 1;
b8 children_sum_y: 1;
b8 keyboard_nav: 1;
};
@@ -83,9 +85,6 @@ struct ui_box_t {
ui_lop_t lop;
UI_DECL_BOX_MEMBERS
r2f32_t full_rect;
r2f32_t rect;
// state
ui_id_t id;
ui_box_t *hash_next;
@@ -159,14 +158,13 @@ fn b32 ui_is_focused_box(ui_box_t *box) { return !ui_is_null_box(box) && box->id
#define ev_right_up(ev) ((ev)->kind == app_event_kind_mouse_up && ev_right(ev))
#define ev_right_down(ev) ((ev)->kind == app_event_kind_mouse_down && ev_right(ev))
fn void ui_set_rect(ui_box_t *box, r2f32_t rect) { box->rect = box->full_rect = rect; }
#define UILOC (ui_code_loc_t){.file = __FILE__, .line = __LINE__, .counter = __COUNTER__}
#define ui_em(x) ((x) * rn->main_font->size)
#define ui_max 200000000.f
#define ui_to_be_determined 0
#define ui_children_sum 0
#define ui_box_flags(...) (ui_box_flag_t){__VA_ARGS__}
fn ui_id_t ui_id(s8_t string);
fn ui_id_t ui_idf(char *str, ...);
fn r2f32_t window_rect_from_frame(app_frame_t *frame);