mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-22 20:11:15 +00:00
Merge
This commit is contained in:
commit
eec97d147c
1 changed files with 48 additions and 0 deletions
|
@ -80,6 +80,7 @@ float scr_con_current;
|
|||
float scr_conlines; // lines of console to display
|
||||
|
||||
float oldscreensize, oldfov;
|
||||
|
||||
cvar_t scr_viewsize = {"viewsize","100", true};
|
||||
cvar_t scr_fov = {"fov","90"}; // 10 - 170
|
||||
cvar_t scr_conspeed = {"scr_conspeed","300"};
|
||||
|
@ -88,6 +89,8 @@ cvar_t scr_showram = {"showram","1"};
|
|||
cvar_t scr_showturtle = {"showturtle","0"};
|
||||
cvar_t scr_showpause = {"showpause","1"};
|
||||
cvar_t scr_printspeed = {"scr_printspeed","8"};
|
||||
cvar_t scr_showfps = {"scr_showfps", "0"};
|
||||
|
||||
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", true };
|
||||
|
||||
extern cvar_t crosshair;
|
||||
|
@ -378,6 +381,8 @@ void SCR_Init (void)
|
|||
Cvar_RegisterVariable (&scr_showpause);
|
||||
Cvar_RegisterVariable (&scr_centertime);
|
||||
Cvar_RegisterVariable (&scr_printspeed);
|
||||
Cvar_RegisterVariable (&scr_showfps);
|
||||
|
||||
Cvar_RegisterVariable (&gl_triplebuffer);
|
||||
|
||||
//
|
||||
|
@ -394,7 +399,49 @@ void SCR_Init (void)
|
|||
scr_initialized = true;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawFPS -- johnfitz
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawFPS (void)
|
||||
{
|
||||
static double oldtime = 0;
|
||||
static double lastfps = 0;
|
||||
static int oldframecount = 0;
|
||||
double elapsed_time;
|
||||
int frames;
|
||||
|
||||
elapsed_time = realtime - oldtime;
|
||||
frames = r_framecount - oldframecount;
|
||||
|
||||
if (elapsed_time < 0 || frames < 0)
|
||||
{
|
||||
oldtime = realtime;
|
||||
oldframecount = r_framecount;
|
||||
return;
|
||||
}
|
||||
// update value every 3/4 second
|
||||
if (elapsed_time > 0.75)
|
||||
{
|
||||
lastfps = frames / elapsed_time;
|
||||
oldtime = realtime;
|
||||
oldframecount = r_framecount;
|
||||
}
|
||||
|
||||
if (scr_showfps.value)
|
||||
{
|
||||
char st[16];
|
||||
int x, y;
|
||||
sprintf (st, "%4.0f fps", lastfps);
|
||||
x = 320 - (strlen(st)<<3);
|
||||
y = 200 - 8;
|
||||
|
||||
Draw_String (0, 0, st);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
|
@ -912,6 +959,7 @@ void SCR_UpdateScreen (void)
|
|||
SCR_DrawPause ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
Sbar_Draw ();
|
||||
SCR_DrawFPS ();
|
||||
SCR_DrawConsole ();
|
||||
M_Draw ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue