From 20854c0f2fbcfd7cf97f4137b17dc70c6991ca7c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 2 Oct 2000 18:24:39 +0000 Subject: [PATCH] Apply fps patch from Timothy C. McGrath that brings sw show_fps from newtree to nuq. --- source/screen.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source/screen.c b/source/screen.c index d59dfc3..0576c58 100644 --- a/source/screen.c +++ b/source/screen.c @@ -422,6 +422,33 @@ void SCR_DrawNet (void) Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net); } +void SCR_DrawFPS (void) +{ + extern cvar_t *show_fps; + static double lastframetime; + double t; + extern int fps_count; + static int lastfps; + int x, y; + char st[80]; + + if (!show_fps->value) + return; + + t = Sys_DoubleTime(); + if ((t - lastframetime) >= 1.0) { + lastfps = fps_count; + fps_count = 0; + lastframetime = t; + } + + sprintf(st, "%3d FPS", lastfps); + x = vid.width - strlen(st) * 8 - 8; + y = vid.height - sb_lines - 8; + Draw_String8 (x, y, st); +} + + /* ============== DrawPause @@ -962,6 +989,7 @@ void SCR_UpdateScreen (void) SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); + SCR_DrawFPS (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole ();