aboutsummaryrefslogtreecommitdiffstats
path: root/examples/demo_utils.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-21 16:08:13 -0500
committerDavid Robillard <d@drobilla.net>2025-01-21 16:24:17 -0500
commitbf01b1e98f1759982e0ee012a3379507f3e72af7 (patch)
treefab71fa4abdb5efa3c9cae6dbf78d0e3bf5aabe6 /examples/demo_utils.h
parent90e05c940a4f99548d982b6976ba9aff8e6bdd8f (diff)
downloadpugl-bf01b1e98f1759982e0ee012a3379507f3e72af7.tar.gz
pugl-bf01b1e98f1759982e0ee012a3379507f3e72af7.tar.bz2
pugl-bf01b1e98f1759982e0ee012a3379507f3e72af7.zip
Fix pugl_shader_demo refresh rate on Windows
Diffstat (limited to 'examples/demo_utils.h')
-rw-r--r--examples/demo_utils.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/demo_utils.h b/examples/demo_utils.h
index b43cc2b..da3b2cd 100644
--- a/examples/demo_utils.h
+++ b/examples/demo_utils.h
@@ -95,13 +95,14 @@ puglPrintFps(const PuglWorld* world,
unsigned* const framesDrawn)
{
const double thisTime = puglGetTime(world);
- if (thisTime > printer->lastReportTime + 5) {
- const double fps = *framesDrawn / (thisTime - printer->lastReportTime);
+ if (thisTime > printer->lastReportTime + 5.0) {
+ const double elapsed = (thisTime - printer->lastReportTime);
+ const double fps = *framesDrawn / elapsed;
fprintf(stderr,
- "FPS: %.2f (%u frames in %.0f seconds)\n",
+ "FPS: %.2f (%u frames / %.2f seconds)\n",
fps,
*framesDrawn,
- thisTime - printer->lastReportTime);
+ elapsed);
printer->lastReportTime = thisTime;
*framesDrawn = 0;