From aa5b95bf0677908709667683b0449365067c0712 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Mar 2020 17:47:17 +0100 Subject: Embed Demo: Simplify FPS counter What we're really interested in here is how often the main loop iteration runs. --- examples/pugl_embed_demo.c | 6 +++--- 1 file 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); } } -- cgit v1.2.1