hot reload working

This commit is contained in:
Krzosa Karol
2025-01-26 11:54:31 +01:00
parent 7831cc51d6
commit f98c8e3dfa
31 changed files with 415 additions and 219 deletions

View File

@@ -2,16 +2,19 @@
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_color"), .value = ui_color_rect_color},
{.name = s8_const_lit("ui_color_rect_hot_color"), .value = ui_color_rect_hot_color},
{.name = s8_const_lit("ui_color_rect_active_color"), .value = ui_color_rect_active_color},
{.name = s8_const_lit("ui_color_border_color"), .value = ui_color_border_color},
{.name = s8_const_lit("ui_color_text_color"), .value = ui_color_text_color},
{.name = s8_const_lit("ui_color_text_hot_color"), .value = ui_color_text_hot_color},
{.name = s8_const_lit("ui_color_text_active_color"), .value = ui_color_text_active_color},
{.name = s8_const_lit("ui_color_focused_rect_color"), .value = ui_color_focused_rect_color},
{.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_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 = 8,
.count = 11,
};
gb v4f32_t ui_color_table[] = {
{0},
@@ -22,71 +25,77 @@ gb v4f32_t ui_color_table[] = {
{0},
{0},
{0},
{0},
{0},
{0},
};
fn void ui_init_colors(void) {
ui_color_table[ui_color_rect_color] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.95f, 1.0f});
ui_color_table[ui_color_rect_hot_color] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.5f, 0.95f, 1.0f});
ui_color_table[ui_color_rect_active_color] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.95f, 1.0f});
ui_color_table[ui_color_border_color] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
ui_color_table[ui_color_text_color] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
ui_color_table[ui_color_text_hot_color] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.4f, 0.70f, 1.0f});
ui_color_table[ui_color_text_active_color] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.70f, 1.0f});
ui_color_table[ui_color_focused_rect_color] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.6f, 0.95f, 1.0f});
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_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_hsla_to_rgba((v4f32_t){0.1f, 0.6f, 0.95f, 1.0f});
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_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_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_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_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_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_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_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_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_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_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_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_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_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_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())
@@ -113,13 +122,13 @@ 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_color]);
ui_push_bg_hot_color(ui_color_table[ui_color_rect_hot_color]);
ui_push_bg_active_color(ui_color_table[ui_color_rect_active_color]);
ui_push_border_color(ui_color_table[ui_color_border_color]);
ui_push_text_color(ui_color_table[ui_color_text_color]);
ui_push_text_hot_color(ui_color_table[ui_color_text_hot_color]);
ui_push_text_active_color(ui_color_table[ui_color_text_active_color]);
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();