diff options
author | quou <quou@disroot.org> | 2024-12-31 13:44:32 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-31 13:44:32 +1100 |
commit | a9a0d1ee84397621b6172693330b48e9474b0a91 (patch) | |
tree | dadae19cdd20d09903438ee07af69b7694af6fef /c2.cpp | |
parent | 0c7b8be8e7d257f2f584121d97bfb899085aa350 (diff) |
UI modal windows
Diffstat (limited to 'c2.cpp')
-rw-r--r-- | c2.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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>("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::Toolbar>(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; |