158 lines
9.6 KiB
C
158 lines
9.6 KiB
C
// automatically generated using: C:\dev\wasm\src/ui/ui.meta.c
|
|
|
|
type_t type__ui_color_t = { type_kind_enum, s8_const_lit("ui_color_t"), sizeof(ui_color_t),
|
|
.members = (type_member_t[]){
|
|
{.name = s8_const_lit("ui_color_rect"), .value = ui_color_rect},
|
|
{.name = s8_const_lit("ui_color_rect_hot"), .value = ui_color_rect_hot},
|
|
{.name = s8_const_lit("ui_color_rect_active"), .value = ui_color_rect_active},
|
|
{.name = s8_const_lit("ui_color_rect_turned_on"), .value = ui_color_rect_turned_on},
|
|
{.name = s8_const_lit("ui_color_border"), .value = ui_color_border},
|
|
{.name = s8_const_lit("ui_color_text"), .value = ui_color_text},
|
|
{.name = s8_const_lit("ui_color_text_hot"), .value = ui_color_text_hot},
|
|
{.name = s8_const_lit("ui_color_text_active"), .value = ui_color_text_active},
|
|
{.name = s8_const_lit("ui_color_focused_rect"), .value = ui_color_focused_rect},
|
|
{.name = s8_const_lit("ui_color_scroller"), .value = ui_color_scroller},
|
|
{.name = s8_const_lit("ui_color_scroller_hot"), .value = ui_color_scroller_hot},
|
|
{.name = s8_const_lit("ui_color_scroller_active"), .value = ui_color_scroller_active},
|
|
},
|
|
.count = 12,
|
|
};
|
|
gb v4f32_t ui_color_table[] = {
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
{0},
|
|
};
|
|
|
|
fn void ui_init_colors(void) {
|
|
ui_color_table[ui_color_rect] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.95f, 1.0f});
|
|
ui_color_table[ui_color_rect_hot] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.5f, 0.95f, 1.0f});
|
|
ui_color_table[ui_color_rect_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.95f, 1.0f});
|
|
ui_color_table[ui_color_rect_turned_on] = v4f32_hsla_to_rgba((v4f32_t){0.4f, 0.5f, 0.95f, 1.0f});
|
|
ui_color_table[ui_color_border] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
|
|
ui_color_table[ui_color_text] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
|
|
ui_color_table[ui_color_text_hot] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.4f, 0.70f, 1.0f});
|
|
ui_color_table[ui_color_text_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.70f, 1.0f});
|
|
ui_color_table[ui_color_focused_rect] = (v4f32_t){1,1,1,1};
|
|
ui_color_table[ui_color_scroller] = ui_color_table[ui_color_text];
|
|
ui_color_table[ui_color_scroller_hot] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.7f, 1.0f});
|
|
ui_color_table[ui_color_scroller_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.5f, 1.0f});
|
|
}
|
|
fn void ui_push_id(ui_id_t v) { ui_id_node_t *n = ma_push_type(tcx->temp, ui_id_node_t); n->value = v; SLLS_PUSH(ui->id_stack, n); }
|
|
fn void ui_pop_id(void) { SLLS_POP(ui->id_stack); }
|
|
fn ui_id_t ui_top_id(void) { return ui->id_stack->value; }
|
|
#define ui_set_id(x) defer_block(ui_push_id(x), ui_pop_id())
|
|
fn void ui_push_lop(ui_lop_t v) { ui_lop_node_t *n = ma_push_type(tcx->temp, ui_lop_node_t); n->value = v; SLLS_PUSH(ui->lop_stack, n); }
|
|
fn void ui_pop_lop(void) { SLLS_POP(ui->lop_stack); }
|
|
fn ui_lop_t ui_top_lop(void) { return ui->lop_stack->value; }
|
|
#define ui_set_lop(x) defer_block(ui_push_lop(x), ui_pop_lop())
|
|
fn void ui_push_border_thickness(f32 v) { ui_f32_node_t *n = ma_push_type(tcx->temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->border_thickness_stack, n); }
|
|
fn void ui_pop_border_thickness(void) { SLLS_POP(ui->border_thickness_stack); }
|
|
fn f32 ui_top_border_thickness(void) { return ui->border_thickness_stack->value; }
|
|
#define ui_set_border_thickness(x) defer_block(ui_push_border_thickness(x), ui_pop_border_thickness())
|
|
fn void ui_push_text_align(ui_text_align_t v) { ui_text_align_node_t *n = ma_push_type(tcx->temp, ui_text_align_node_t); n->value = v; SLLS_PUSH(ui->text_align_stack, n); }
|
|
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_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 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_string_pos_offset(f32 v) { ui_f32_node_t *n = ma_push_type(tcx->temp, ui_f32_node_t); n->value = v; SLLS_PUSH(ui->string_pos_offset_stack, n); }
|
|
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_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; }
|
|
#define ui_set_border_color(x) defer_block(ui_push_border_color(x), ui_pop_border_color())
|
|
fn void ui_push_text_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_color_stack, n); }
|
|
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_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_size_stack == NULL);
|
|
assert(ui->padding_stack == NULL);
|
|
assert(ui->string_pos_offset_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->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_string_pos_offset(0);
|
|
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]);
|
|
ui_push_border_color(ui_color_table[ui_color_border]);
|
|
ui_push_text_color(ui_color_table[ui_color_text]);
|
|
ui_push_text_hot_color(ui_color_table[ui_color_text_hot]);
|
|
ui_push_text_active_color(ui_color_table[ui_color_text_active]);
|
|
}
|
|
fn void ui_pop_init_values(void) {
|
|
ui_pop_id();
|
|
ui_pop_lop();
|
|
ui_pop_border_thickness();
|
|
ui_pop_text_align();
|
|
ui_pop_string_pos_offset();
|
|
ui_pop_background_color();
|
|
ui_pop_bg_hot_color();
|
|
ui_pop_bg_active_color();
|
|
ui_pop_border_color();
|
|
ui_pop_text_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();
|
|
} |