From 4eadddd8ab75a7164272856ed2fac2987286c5b3 Mon Sep 17 00:00:00 2001 From: mbjornstk Date: Tue, 31 Mar 2009 18:04:04 +0000 Subject: [PATCH] Small logic changes to the FPS reporting, only update if FPS>1. Still disabled, but at least nobody would say there is a bug like min FPS being 999. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3330 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/main_loop.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main_loop.cpp b/src/main_loop.cpp index f8a3990c7..c59c9ea00 100644 --- a/src/main_loop.cpp +++ b/src/main_loop.cpp @@ -222,19 +222,23 @@ void MainLoop::run() #if 0 int fps = irr_driver->getDevice()->getVideoDriver()->getFPS(); bool printFPS = false; - if((fps < minFPS) && (fps > 1)) { // First report seems to be always 1, so not useful - minFPS = fps; - printFPS = true; - } - if(fps > maxFPS) { - maxFPS = fps; - printFPS = true; - } - if ((lastFPS+5 <= fps) || (lastFPS-5 >= fps)) { - lastFPS = fps; - printFPS = true; - } - // First print per run will be really silly, as in 999 1 1, just ignore it ;] + // First reports seem to be always 1, so not useful + if (fps > 1) { + // More than +-5 range is interesting to report (otherwise noise) + if ((lastFPS+5 <= fps) || (lastFPS-5 >= fps)) { + lastFPS = fps; + printFPS = true; + } + // Min and max are worth updating any time they happen + if (fps < minFPS) { + minFPS = fps; + printFPS = true; + } + if (fps > maxFPS) { + maxFPS = fps; + printFPS = true; + } + } // no else, or you get over 50 'printf ("FPS below 1!\n")' easily if (printFPS) printf("FPS %3d<%3d<%3d\n", minFPS, fps, maxFPS); #endif #else