small hto load improvements

This commit is contained in:
Krzosa Karol
2025-01-26 19:55:31 +01:00
parent 5d127b7f2c
commit 8ae6e15bf8
18 changed files with 197 additions and 216 deletions

View File

@@ -894,7 +894,6 @@ fn void ui_serial_subtype(void *p, type_t *type, s8_t name) {
fn void ui_serial_type(void *p, type_t *type) {
ui_serial_subtype(p, type, type->name);
}
//
fn void ui_reload(void) {
ui_init_colors();
@@ -907,6 +906,7 @@ fn void ui_init(ma_arena_t *arena) {
ui_reload();
}
gb app_event_t ui_test_event;
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(frame);
@@ -921,12 +921,11 @@ 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, "4");
ui_radio_button(&ui_g_panel, 2, "2");
}
ui->top->rect = r2f32_shrinks(ui->top->rect, ui_em(1));
if (ui_g_panel == 1) {
ui_box_t *scroller_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "scrollbar");
ui_set_rect(scroller_box, r2f32_cut_right(&ui->top->rect, 10 * frame->dpr), ui_lop_cut_right);
@@ -969,7 +968,11 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
} else_is_invalid;
}
ui_label("allocated boxes: %d", ui->allocated_boxes);
// ui_serial_type(&ui_test_event, type(app_event_t));
ui_serial_type(&ui_test_event, type(app_event_t));
ui_set_id(ui_idf("a")) {
ui_serial_type(&ui_test_event, type(app_event_t));
}
}
locl f32 scroller_value;
@@ -992,7 +995,7 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
ui_set_rect(box, r2f32_cut_top(&ui->top->rect, scroller_size * scroller_box_size), ui_lop_cut_top);
ui_signal_t signal = ui_signal_from_box(box);
if (signal.dragging) {
scroller_value += (signal.drag.y / item_box_size * 2) * (all_items_size);
scroller_value += signal.drag.y;
scroller_value = CLAMP(scroller_value, 0, all_items_size);
}
if (ev->kind == app_event_kind_mouse_wheel) {