aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-08 17:47:17 +0100
committerDavid Robillard <d@drobilla.net>2020-03-08 18:06:52 +0100
commitaa5b95bf0677908709667683b0449365067c0712 (patch)
treeeab20cfed5783221dfdb3f79fdd25c491afc1595 /examples
parent6d099f40f04e4fb5594d53e10f57a6bd541ee568 (diff)
downloadpugl-aa5b95bf0677908709667683b0449365067c0712.tar.gz
pugl-aa5b95bf0677908709667683b0449365067c0712.tar.bz2
pugl-aa5b95bf0677908709667683b0449365067c0712.zip
Embed Demo: Simplify FPS counter
What we're really interested in here is how often the main loop iteration runs.
Diffstat (limited to 'examples')
-rw-r--r--examples/pugl_embed_demo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index 3907801..b122253 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -49,7 +49,6 @@ typedef struct
double lastMouseX;
double lastMouseY;
double lastDrawTime;
- unsigned framesDrawn;
bool mouseEntered;
bool verbose;
} PuglTestApp;
@@ -90,7 +89,6 @@ onDisplay(PuglView* view)
displayCube(view, app->dist, app->xAngle, app->yAngle, app->mouseEntered);
app->lastDrawTime = thisTime;
- ++app->framesDrawn;
}
static void
@@ -316,6 +314,7 @@ main(int argc, char** argv)
puglShowWindow(app.child);
PuglFpsPrinter fpsPrinter = { puglGetTime(app.world) };
+ unsigned framesDrawn = 0;
bool requestedAttention = false;
while (!app.quit) {
const double thisTime = puglGetTime(app.world);
@@ -328,6 +327,7 @@ main(int argc, char** argv)
}
puglDispatchEvents(app.world);
+ ++framesDrawn;
if (!requestedAttention && thisTime > 5.0) {
puglRequestAttention(app.parent);
@@ -335,7 +335,7 @@ main(int argc, char** argv)
}
if (app.continuous) {
- puglPrintFps(app.world, &fpsPrinter, &app.framesDrawn);
+ puglPrintFps(app.world, &fpsPrinter, &framesDrawn);
}
}