This commit is contained in:
Krzosa Karol
2025-01-13 10:31:23 +01:00
parent dd796b12f4
commit b4d3f20cad
8 changed files with 410 additions and 333 deletions

View File

@@ -1,5 +1,6 @@
#include "core/core_inc.h"
#include "app/app.h"
#include "ui.h"
#include "core/core_inc.c"
#include "app/app.c"
@@ -11,6 +12,7 @@
#include "render/render_opengl.c"
// #include "gfx2d/gfx2d.c"dv
#include "ui_iter.c"
#include "ui.c"
/*
@@ -31,48 +33,61 @@ struct globals_t {
gb globals_t *globals;
fn void app_init(void) {
fn void app_init(f32 dpr) {
ma_arena_t *perm = &tcx._perm;
globals = ma_push_type(perm, globals_t);
ma_arena_t *ui_arena = ma_push_arena(perm, mib(1));
ui_init(ui_arena);
rn_init(perm);
rn_init(perm, 50 * dpr);
}
fn f32 get_font_size(void) {
f32 size = rn_state.main_font.size;
return size;
}
fn b32 app_update(app_frame_t *frame) {
assert(frame != NULL);
ui_begin_frame(frame);
v2f32_t size = rn_measure_string(&rn_state.main_font, s8_lit("a"));
unused(size);
assert(frame->first_event);
for (app_event_t *ev = frame->first_event; ev; ev = ev->next) {
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(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##asd").clicked, ui_pop_exp()) {
defer_block(ui_push_xcontainer(UI_CODE_LOC, ui_em(25), ui_em(30)), ui_pop_parent()) {
defer_block(ui_push_container(UI_CODE_LOC, ui_percent(97), ui_percent(100)), 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");
}
defer_if (ui_push_exp(UI_CODE_LOC, "inner_pos: v2f64_t##qwe").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, "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##asd").clicked, ui_pop_exp()) {
ui_label(UI_CODE_LOC, "x: f64 = value");
ui_label(UI_CODE_LOC, "y: f64 = value");
}
defer_if (ui_push_exp(UI_CODE_LOC, "inner_pos: v2f64_t##qwe").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, "y: f64 = value");
ui_label(UI_CODE_LOC, "alt: b8 = value");
ui_label(UI_CODE_LOC, "meta: b8 = value");
}
ui_label(UI_CODE_LOC, "alt: b8 = value");
ui_label(UI_CODE_LOC, "meta: b8 = value");
}
// scroller
{
ui_push_container(UI_CODE_LOC, ui_percent(3), ui_percent(100));
ui_pop_parent();
}
}
}