hot reload refactor

This commit is contained in:
Krzosa Karol
2025-01-26 12:46:14 +01:00
parent f98c8e3dfa
commit 5d127b7f2c
12 changed files with 64 additions and 51 deletions

View File

@@ -670,8 +670,8 @@ fn void ui_draw(void) {
ui__draw_box(ui->frame, &ui->root);
}
fn void ui_begin_frame(ui_t *ui_context, app_frame_t *frame) {
ui = ui_context;
fn void ui_begin_frame(app_frame_t *frame) {
ui = tcx->data[tcx_slot_ui];
ui->frame = frame;
}
@@ -896,17 +896,21 @@ fn void ui_serial_type(void *p, type_t *type) {
}
//
fn void ui_demo_init(ma_arena_t *arena) {
tcx->data[1] = ma_push_type(arena, ui_t);
ui = tcx->data[1];
ui->box_arena = ma_push_arena(arena, mib(1));
fn void ui_reload(void) {
ui_init_colors();
}
fn void ui_init(ma_arena_t *arena) {
tcx->data[tcx_slot_ui] = ma_push_type(arena, ui_t);
ui = tcx->data[tcx_slot_ui];
ui->box_arena = ma_push_arena(arena, mib(1));
ui_reload();
}
gb i32 ui_g_panel = 1;
fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_count) {
ui_begin_frame(tcx->data[1], frame);
rn_begin_frame(tcx->data[0], frame);
ui_begin_frame(frame);
rn_begin_frame(frame);
for (app_event_t *ev = frame->first_event; ev; ev = ev->next) {
ui_begin_build(UILOC, ev, window_rect_from_frame(frame));
@@ -917,7 +921,7 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
ui_set_lop(ui_lop_cut_left)
ui_set_top(top_box) {
ui_radio_button(&ui_g_panel, 1, "1");
ui_radio_button(&ui_g_panel, 2, "2");
ui_radio_button(&ui_g_panel, 2, "4");
}
ui->top->rect = r2f32_shrinks(ui->top->rect, ui_em(1));