Thinking about ids

This commit is contained in:
Krzosa Karol
2025-01-11 12:32:29 +01:00
parent 3acc1c2ca4
commit e8c8c1bf5c
2 changed files with 161 additions and 127 deletions

View File

@@ -47,30 +47,31 @@ fn b32 app_update(app_frame_t *frame) {
assert(frame->first_event);
for (app_event_t *ev = frame->first_event; ev; ev = ev->next) {
defer_block(ui_begin_build(FILE_AND_LINE, ev), ui_end_build()) {
defer_block(ui_push_list_container(FILE_AND_LINE), ui_pop_parent()) {
defer_if (ui_push_expander(FILE_AND_LINE, "app_event_t").clicked, ui_pop_expander()) {
defer_if (ui_push_expander(FILE_AND_LINE, "mouse_wheel_delta: v3f64_t").clicked, ui_pop_expander()) {
ui_label(FILE_AND_LINE, "x: f64 = value");
ui_label(FILE_AND_LINE, "y: f64 = value");
ui_label(FILE_AND_LINE, "z: f64 = value");
defer_block(ui_begin_build(UI_CODE_LOC, ev), ui_end_build()) {
defer_block(ui_push_list_container(UI_CODE_LOC), ui_pop_parent()) {
defer_if (ui_push_exp(UI_CODE_LOC, "app_event_t").clicked, ui_pop_exp()) {
defer_if (ui_push_exp(UI_CODE_LOC, "mouse_wheel_delta: v3f64_t").clicked, ui_pop_exp()) {
ui_label(UI_CODE_LOC, "x: f64 = value");
ui_label(UI_CODE_LOC, "y: f64 = value");
ui_label(UI_CODE_LOC, "z: f64 = value");
}
ui_label(FILE_AND_LINE, "kind: app_event_kind_t = value");
ui_label(FILE_AND_LINE, "ctrl: b8 = value");
ui_label(FILE_AND_LINE, "shift: b8 = value");
defer_if (ui_push_expander(FILE_AND_LINE, "pos: v2f64_t").clicked, ui_pop_expander()) {
defer_if (ui_push_expander(FILE_AND_LINE, "inner_pos: v2f64_t").clicked, ui_pop_expander()) {
ui_label(FILE_AND_LINE, "x_: f64 = value");
ui_label(FILE_AND_LINE, "y_: f64 = value");
}
ui_label(FILE_AND_LINE, "y__: f64 = value");
defer_if (ui_push_expander(FILE_AND_LINE, "_inner_pos: v2f64_t").clicked, ui_pop_expander()) {
ui_label(FILE_AND_LINE, "x____: f64 = value");
ui_label(FILE_AND_LINE, "y____: f64 = value");
}
defer_if (ui_push_exp(UI_CODE_LOC, "inner_pos: v2f64_t").clicked, ui_pop_exp()) {
ui_label(UI_CODE_LOC, "x: f64 = value");
ui_label(UI_CODE_LOC, "y: f64 = value");
}
ui_label(FILE_AND_LINE, "alt: b8 = value");
ui_label(FILE_AND_LINE, "meta: b8 = value");
ui_label(UI_CODE_LOC, "kind: app_event_kind_t = value");
ui_label(UI_CODE_LOC, "ctrl: b8 = value");
ui_label(UI_CODE_LOC, "shift: b8 = value");
defer_if (ui_push_exp(UI_CODE_LOC, "pos: v2f64_t").clicked, ui_pop_exp()) {
defer_if (ui_push_exp(UI_CODE_LOC, "inner_pos: v2f64_t").clicked, ui_pop_exp()) {
ui_label(UI_CODE_LOC, "x: f64 = value");
ui_label(UI_CODE_LOC, "y: f64 = value");
}
ui_label(UI_CODE_LOC, "y: f64 = value");
}
ui_label(UI_CODE_LOC, "alt: b8 = value");
ui_label(UI_CODE_LOC, "meta: b8 = value");
}
}
}
@@ -79,45 +80,9 @@ fn b32 app_update(app_frame_t *frame) {
rn_begin();
ui_draw();
rn_draw_stringf(&rn_state.main_font, v2f32(0,frame->window_size.y - 100), black_color_global, "ui_boxes: %d delta: %f update: %f", ui->allocated_boxes, frame->delta, frame->update);
rn_draw_stringf(&rn_state.main_font, v2f32(0,frame->window_size.y - 100), black_color_global, "ui_boxes: %d delta: %f update: %f event_count: %d", ui->allocated_boxes, frame->delta, frame->update, frame->event_count);
rn_end(frame->window_size, white_color_global);
#if 0
// These steps should be totally optional!!
{
app_event_t *ev = events.last;
f64 delta = app_get_anim_delta_time();
f64 time = app_get_anim_time();
f64 font_height = get_font_height();
// animate
// render
gfx_begin(globals->gfx, ev);
gfx_clear(globals->gfx, white_color_global);
gfx_textf(globals->gfx, (v2f64_t){0,ev->window_size.y - font_height}, black_color_global,
"delta: %f, time: %f widget_count: %d", delta, time, (i32)ui->allocated_boxes);
// ►
type_t *ti = type(app_event_t);
f64 xoffset = measure_text("--");
v2f64_t p = {0, 0};
gfx_textf(globals->gfx, p, black_color_global, "▼ %S: struct", ti->name);
p.x += xoffset; p.y += font_height + 5;
for (type_member_t *tm = ti->members; tm < ti->members + ti->count; tm += 1) {
s8_t value = ti__serial_data(tcx.temp, ti_extract_member(&globals->event, tm), tm->type);
gfx_textf(globals->gfx, p, black_color_global, "%-20S: %-20S = %S", tm->name, ti_serial_type(tcx.temp, tm->type), value);
p.y += font_height + 5;
}
ui_draw(globals->gfx);
gfx_end(globals->gfx);
}
#endif
ui_end_frame();
return true;
}