From a9a0d1ee84397621b6172693330b48e9474b0a91 Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 31 Dec 2024 13:44:32 +1100 Subject: UI modal windows --- c2.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'c2.cpp') diff --git a/c2.cpp b/c2.cpp index e3e8542..d356ada 100644 --- a/c2.cpp +++ b/c2.cpp @@ -1,4 +1,5 @@ #include "app.hpp" +#include "debugger.hpp" #include "model.hpp" #include "ui.hpp" #include "video.hpp" @@ -22,7 +23,9 @@ static float verts[] = { struct C2 : public App { Device* dev; + UI* ui; void on_resize() override { + ui->layout(w, h); dev->on_resize(); } }; @@ -84,8 +87,8 @@ extern "C" int entrypoint() { Model* monkey; Buffer_Id vbo, cbuf; Sampler_Id clamped_linear; - UI* ui; C2* app = App::create("c2"); + UI* ui; void* per_frame; int frame = 0; app->running = 1; @@ -125,12 +128,16 @@ extern "C" int entrypoint() { per_frame_memory_size ); clamped_linear = create_clamped_linear(dev); - ui = UI::create(dev, &ui_arena, ui_shader->id); + ui = UI::create(dev, app, &ui_arena, ui_shader->id); + app->ui = ui; assert(per_frame != 0); uint8_t r = 0; float rot = 0.0f; v3f raxis(0.0f, 1.0f, 0.0); vbo = upload_verts(dev); + ui->layout(app->w, app->h); + auto toolbar = ui->create_element(ui->root); + register_debuggers(ui, toolbar); while (app->running) { Arena frame_arena; init_arena(&frame_arena, per_frame, per_frame_memory_size); @@ -138,7 +145,7 @@ extern "C" int entrypoint() { app->begin(); dev->begin_frame(); - ui->update(&frame_arena, *app); + ui->update(&frame_arena); { void* mem; -- cgit v1.2.3-54-g00ecf