From 96b27fe9841e537614962e273ef9f0802365ea6d Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 31 Dec 2024 23:38:11 +1100 Subject: ui stuf and things hmm m mmm m シ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'c2.cpp') diff --git a/c2.cpp b/c2.cpp index d356ada..fb2aa38 100644 --- a/c2.cpp +++ b/c2.cpp @@ -9,6 +9,7 @@ extern "C" { } #include #include +#include #define video_arena_size (1024 * 1024 * 16) #define asset_arena_size (1024 * 1024 * 4) @@ -138,6 +139,7 @@ extern "C" int entrypoint() { ui->layout(app->w, app->h); auto toolbar = ui->create_element(ui->root); register_debuggers(ui, toolbar); + auto fps_label = ui->create_element(ui->root, ""); while (app->running) { Arena frame_arena; init_arena(&frame_arena, per_frame, per_frame_memory_size); @@ -145,6 +147,11 @@ extern "C" int entrypoint() { app->begin(); dev->begin_frame(); + if (frame % 10 == 0) { + char buf[32]; + sprintf(buf, "FPS: %g", 1.0f / app->dt); + fps_label->set_text(buf); + } ui->update(&frame_arena); { @@ -246,7 +253,7 @@ extern "C" int entrypoint() { ctx.debug_pop(); r += 10; - rot += 0.05f; + rot += 5.0f * app->dt; frame++; dev->present(); app->end(); -- cgit v1.2.3-54-g00ecf