changed now showfps calculates the fps - hopefully an improvement
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 14:09:14 +0000 (14:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 14:09:14 +0000 (14:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8086 d7cf8633-e32d-0410-b094-e92efae38249

sbar.c

diff --git a/sbar.c b/sbar.c
index ef7a0bc..e493b6d 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1057,13 +1057,16 @@ void Sbar_ShowFPS(void)
                static double nexttime = 0, lasttime = 0;
                static double framerate = 0;
                static int framecount = 0;
+               double interval = 0.25;
                double newtime;
                newtime = realtime;
                if (newtime >= nexttime)
                {
                        framerate = framecount / (newtime - lasttime);
+                       if (nexttime < newtime - interval * 1.5)
+                               nexttime = newtime;
                        lasttime = newtime;
-                       nexttime = max(nexttime + 1, lasttime - 1);
+                       nexttime += interval;
                        framecount = 0;
                }
                framecount++;