diff options
author | David Robillard <d@drobilla.net> | 2019-08-02 21:39:15 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-08-02 23:28:15 +0200 |
commit | b628c72193e068277ab4fbf0e6db9a572c43be46 (patch) | |
tree | 2e4d5aeafe5a2a9742496ebd6d4e494467eb5c77 /test/pugl_test.c | |
parent | 2359dafa529216a3b3a327edb9e4b5daf92985f7 (diff) | |
download | pugl-b628c72193e068277ab4fbf0e6db9a572c43be46.tar.gz pugl-b628c72193e068277ab4fbf0e6db9a572c43be46.tar.bz2 pugl-b628c72193e068277ab4fbf0e6db9a572c43be46.zip |
Test: Factor out FPS printer
Diffstat (limited to 'test/pugl_test.c')
-rw-r--r-- | test/pugl_test.c | 14 |
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); } } |