aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/pugl_test.c')
-rw-r--r--test/pugl_test.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/pugl_test.c b/test/pugl_test.c
index f276d8a..12ce529 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -196,8 +196,8 @@ main(int argc, char** argv)
puglShowWindow(view);
- float lastReportTime = (float)puglGetTime(view);
- bool requestedAttention = false;
+ PuglFpsPrinter fpsPrinter = { puglGetTime(view) };
+ bool requestedAttention = false;
while (!quit) {
const float thisTime = (float)puglGetTime(view);
@@ -214,14 +214,8 @@ main(int argc, char** argv)
requestedAttention = true;
}
- if (continuous && thisTime > lastReportTime + 5) {
- const double fps = framesDrawn / (thisTime - lastReportTime);
- fprintf(stderr,
- "%u frames in %.0f seconds = %.3f FPS\n",
- framesDrawn, thisTime - lastReportTime, fps);
-
- lastReportTime = thisTime;
- framesDrawn = 0;
+ if (continuous) {
+ puglPrintFps(view, &fpsPrinter, &framesDrawn);
}
}