forked from fte/fteqw
1
0
Fork 0

negative values of show_fps show milliseconds per frame instead of FPS

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2291 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-19 19:54:03 +00:00
parent d2584c26b9
commit 52393e83ae
1 changed files with 20 additions and 8 deletions

View File

@ -1193,6 +1193,8 @@ void SCR_DrawFPS (void)
extern int fps_count;
static float lastfps;
char str[80];
int sfps;
qboolean usemsecs = false;
if (!show_fps.value)
return;
@ -1205,31 +1207,41 @@ void SCR_DrawFPS (void)
lastframetime = t;
}
if (show_fps.value == 2) //alternate mode that displays the lowest noticed
sfps = show_fps.value;
if (sfps < 0)
{
sfps = -sfps;
usemsecs = true;
}
switch (sfps)
{
case 2: // lowest FPS, highest MS encountered
if (lastfps > 1/host_frametime)
{
lastfps = 1/host_frametime;
fps_count = 0;
lastframetime = t;
}
}
else if (show_fps.value == 3) //alternate mode that displays the highest noticed
{
break;
case 3: // highest FPS, lowest MS encountered
if (lastfps < 1/host_frametime)
{
lastfps = 1/host_frametime;
fps_count = 0;
lastframetime = t;
}
}
else if (show_fps.value == 4) //alternate mode that displays the highest noticed
{
break;
case 4:
lastfps = 1/host_frametime;
lastframetime = t;
break;
}
sprintf(str, "%3.1f FPS", lastfps);
if (usemsecs)
sprintf(str, "%4.1f MS", 1000.0/lastfps);
else
sprintf(str, "%3.1f FPS", lastfps);
SCR_StringXY(str, show_fps_x.value, show_fps_y.value);
}