refactor padding, required size. Working on colors
This commit is contained in:
@@ -15,22 +15,26 @@ fn void ui_push_text_align(ui_text_align_t v) { ui_text_align_node_t *n = ma_pus
|
||||
fn void ui_pop_text_align(void) { SLLS_POP(ui->text_align_stack); }
|
||||
fn ui_text_align_t ui_top_text_align(void) { return ui->text_align_stack->value; }
|
||||
#define ui_set_text_align(x) defer_block(ui_push_text_align(x), ui_pop_text_align())
|
||||
fn void ui_push_required_width(f32 v) { ui_f32_node_t *n = ma_push_type(tcx.temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->required_width_stack, n); }
|
||||
fn void ui_pop_required_width(void) { SLLS_POP(ui->required_width_stack); }
|
||||
fn f32 ui_top_required_width(void) { return ui->required_width_stack->value; }
|
||||
#define ui_set_required_width(x) defer_block(ui_push_required_width(x), ui_pop_required_width())
|
||||
fn void ui_push_required_height(f32 v) { ui_f32_node_t *n = ma_push_type(tcx.temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->required_height_stack, n); }
|
||||
fn void ui_pop_required_height(void) { SLLS_POP(ui->required_height_stack); }
|
||||
fn f32 ui_top_required_height(void) { return ui->required_height_stack->value; }
|
||||
#define ui_set_required_height(x) defer_block(ui_push_required_height(x), ui_pop_required_height())
|
||||
fn void ui_push_padding(v2f32_t v) { ui_v2f32_node_t *n = ma_push_type(tcx.temp, ui_v2f32_node_t); n->value = v; SLLS_PUSH(ui->padding_stack, n); }
|
||||
fn void ui_push_required_size(f32 v) { ui_f32_node_t *n = ma_push_type(tcx.temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->required_size_stack, n); }
|
||||
fn void ui_pop_required_size(void) { SLLS_POP(ui->required_size_stack); }
|
||||
fn f32 ui_top_required_size(void) { return ui->required_size_stack->value; }
|
||||
#define ui_set_required_size(x) defer_block(ui_push_required_size(x), ui_pop_required_size())
|
||||
fn void ui_push_padding(f32 v) { ui_f32_node_t *n = ma_push_type(tcx.temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->padding_stack, n); }
|
||||
fn void ui_pop_padding(void) { SLLS_POP(ui->padding_stack); }
|
||||
fn v2f32_t ui_top_padding(void) { return ui->padding_stack->value; }
|
||||
fn f32 ui_top_padding(void) { return ui->padding_stack->value; }
|
||||
#define ui_set_padding(x) defer_block(ui_push_padding(x), ui_pop_padding())
|
||||
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; }
|
||||
#define ui_set_background_color(x) defer_block(ui_push_background_color(x), ui_pop_background_color())
|
||||
fn void ui_push_bg_hot_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->bg_hot_color_stack, n); }
|
||||
fn void ui_pop_bg_hot_color(void) { SLLS_POP(ui->bg_hot_color_stack); }
|
||||
fn v4f32_t ui_top_bg_hot_color(void) { return ui->bg_hot_color_stack->value; }
|
||||
#define ui_set_bg_hot_color(x) defer_block(ui_push_bg_hot_color(x), ui_pop_bg_hot_color())
|
||||
fn void ui_push_bg_active_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->bg_active_color_stack, n); }
|
||||
fn void ui_pop_bg_active_color(void) { SLLS_POP(ui->bg_active_color_stack); }
|
||||
fn v4f32_t ui_top_bg_active_color(void) { return ui->bg_active_color_stack->value; }
|
||||
#define ui_set_bg_active_color(x) defer_block(ui_push_bg_active_color(x), ui_pop_bg_active_color())
|
||||
fn void ui_push_border_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->border_color_stack, n); }
|
||||
fn void ui_pop_border_color(void) { SLLS_POP(ui->border_color_stack); }
|
||||
fn v4f32_t ui_top_border_color(void) { return ui->border_color_stack->value; }
|
||||
@@ -39,33 +43,42 @@ fn void ui_push_text_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.te
|
||||
fn void ui_pop_text_color(void) { SLLS_POP(ui->text_color_stack); }
|
||||
fn v4f32_t ui_top_text_color(void) { return ui->text_color_stack->value; }
|
||||
#define ui_set_text_color(x) defer_block(ui_push_text_color(x), ui_pop_text_color())
|
||||
fn void ui_push_radio_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->radio_color_stack, n); }
|
||||
fn void ui_pop_radio_color(void) { SLLS_POP(ui->radio_color_stack); }
|
||||
fn v4f32_t ui_top_radio_color(void) { return ui->radio_color_stack->value; }
|
||||
#define ui_set_radio_color(x) defer_block(ui_push_radio_color(x), ui_pop_radio_color())
|
||||
fn void ui_push_text_hot_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->text_hot_color_stack, n); }
|
||||
fn void ui_pop_text_hot_color(void) { SLLS_POP(ui->text_hot_color_stack); }
|
||||
fn v4f32_t ui_top_text_hot_color(void) { return ui->text_hot_color_stack->value; }
|
||||
#define ui_set_text_hot_color(x) defer_block(ui_push_text_hot_color(x), ui_pop_text_hot_color())
|
||||
fn void ui_push_text_active_color(v4f32_t v) { ui_v4f32_node_t *n = ma_push_type(tcx.temp, ui_v4f32_node_t); n->value = v; SLLS_PUSH(ui->text_active_color_stack, n); }
|
||||
fn void ui_pop_text_active_color(void) { SLLS_POP(ui->text_active_color_stack); }
|
||||
fn v4f32_t ui_top_text_active_color(void) { return ui->text_active_color_stack->value; }
|
||||
#define ui_set_text_active_color(x) defer_block(ui_push_text_active_color(x), ui_pop_text_active_color())
|
||||
|
||||
fn void ui_assert_stacks_are_null(void) {
|
||||
assert(ui->id_stack == NULL);
|
||||
assert(ui->lop_stack == NULL);
|
||||
assert(ui->border_thickness_stack == NULL);
|
||||
assert(ui->text_align_stack == NULL);
|
||||
assert(ui->required_width_stack == NULL);
|
||||
assert(ui->required_height_stack == NULL);
|
||||
assert(ui->required_size_stack == NULL);
|
||||
assert(ui->padding_stack == NULL);
|
||||
assert(ui->background_color_stack == NULL);
|
||||
assert(ui->bg_hot_color_stack == NULL);
|
||||
assert(ui->bg_active_color_stack == NULL);
|
||||
assert(ui->border_color_stack == NULL);
|
||||
assert(ui->text_color_stack == NULL);
|
||||
assert(ui->radio_color_stack == NULL);
|
||||
assert(ui->text_hot_color_stack == NULL);
|
||||
assert(ui->text_active_color_stack == NULL);
|
||||
}
|
||||
fn void ui_push_init_values(void) {
|
||||
ui_push_id(ui_idf("root"));
|
||||
ui_push_lop(ui_lop_cut_top);
|
||||
ui_push_border_thickness(1.0f);
|
||||
ui_push_text_align(ui_text_align_left);
|
||||
ui_push_background_color(v4f32_rgba255(245, 238, 230, 255));
|
||||
ui_push_border_color(v4f32_rgba255(230, 164, 180, 255));
|
||||
ui_push_text_color(v4f32_rgba255(0, 0, 0, 255));
|
||||
ui_push_radio_color(v4f32_rgba255(243, 215, 202, 255));
|
||||
ui_push_background_color(v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.95f, 1.0f}));
|
||||
ui_push_bg_hot_color(v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.5f, 0.95f, 1.0f}));
|
||||
ui_push_bg_active_color(v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.95f, 1.0f}));
|
||||
ui_push_border_color(v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.7f, 1.0f}));
|
||||
ui_push_text_color(v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.7f, 1.0f}));
|
||||
ui_push_text_hot_color(v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.4f, 0.7f, 1.0f}));
|
||||
ui_push_text_active_color(v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.7f, 1.0f}));
|
||||
}
|
||||
fn void ui_pop_init_values(void) {
|
||||
ui_pop_id();
|
||||
@@ -73,7 +86,19 @@ ui_pop_lop();
|
||||
ui_pop_border_thickness();
|
||||
ui_pop_text_align();
|
||||
ui_pop_background_color();
|
||||
ui_pop_bg_hot_color();
|
||||
ui_pop_bg_active_color();
|
||||
ui_pop_border_color();
|
||||
ui_pop_text_color();
|
||||
ui_pop_radio_color();
|
||||
ui_pop_text_hot_color();
|
||||
ui_pop_text_active_color();
|
||||
}
|
||||
fn void ui_box_fill_with_colors(ui_box_t *box) {
|
||||
box->background_color = ui_top_background_color();
|
||||
box->bg_hot_color = ui_top_bg_hot_color();
|
||||
box->bg_active_color = ui_top_bg_active_color();
|
||||
box->border_color = ui_top_border_color();
|
||||
box->text_color = ui_top_text_color();
|
||||
box->text_hot_color = ui_top_text_hot_color();
|
||||
box->text_active_color = ui_top_text_active_color();
|
||||
}
|
||||
Reference in New Issue
Block a user