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

@@ -74,6 +74,10 @@ fn void ui_push_string_pos_offset(f32 v) { ui_f32_node_t *n = ma_push_type(tcx->
fn void ui_pop_string_pos_offset(void) { SLLS_POP(ui->string_pos_offset_stack); }
fn f32 ui_top_string_pos_offset(void) { return ui->string_pos_offset_stack->value; }
#define ui_set_string_pos_offset(x) defer_block(ui_push_string_pos_offset(x), ui_pop_string_pos_offset())
fn void ui_push_rect(r2f32_t v) { ui_r2f32_node_t *n = ma_push_type(tcx->temp, ui_r2f32_node_t); n->value = v; SLLS_PUSH(ui->rect_stack, n); }
fn void ui_pop_rect(void) { SLLS_POP(ui->rect_stack); }
fn r2f32_t ui_top_rect(void) { return ui->rect_stack->value; }
#define ui_set_rect(x) defer_block(ui_push_rect(x), ui_pop_rect())
fn void ui_push_background_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx->temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->background_color_stack, n); }
fn void ui_pop_background_color(void) { SLLS_POP(ui->background_color_stack); }
fn v4f32_t ui_top_background_color(void) { return ui->background_color_stack->value; }
@@ -111,6 +115,7 @@ assert(ui->text_align_stack == NULL);
assert(ui->required_size_stack == NULL);
assert(ui->padding_stack == NULL);
assert(ui->string_pos_offset_stack == NULL);
assert(ui->rect_stack == NULL);
assert(ui->background_color_stack == NULL);
assert(ui->bg_hot_color_stack == NULL);
assert(ui->bg_active_color_stack == NULL);
@@ -125,6 +130,7 @@ ui_push_lop(ui_lop_cut_top);
ui_push_border_thickness(1.0f);
ui_push_text_align(ui_text_align_left);
ui_push_string_pos_offset(0);
ui_push_rect(window_rect_from_frame(ui->frame));
ui_push_background_color(ui_color_table[ui_color_rect]);
ui_push_bg_hot_color(ui_color_table[ui_color_rect_hot]);
ui_push_bg_active_color(ui_color_table[ui_color_rect_active]);
@@ -139,6 +145,7 @@ ui_pop_lop();
ui_pop_border_thickness();
ui_pop_text_align();
ui_pop_string_pos_offset();
ui_pop_rect();
ui_pop_background_color();
ui_pop_bg_hot_color();
ui_pop_bg_active_color();