summaryrefslogtreecommitdiff
path: root/c2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c2.cpp')
-rw-r--r--c2.cpp9
1 files changed, 8 insertions, 1 deletions
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 <string.h>
#include <math.h>
+#include <stdio.h>
#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::Toolbar>(ui->root);
register_debuggers(ui, toolbar);
+ auto fps_label = ui->create_element<UI::Label>(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();