mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +00:00
r_showfps 2, displaying min and max fps
git-svn-id: https://svn.eduke32.com/eduke32@4622 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5d1475b26c
commit
e20f297774
4 changed files with 43 additions and 10 deletions
|
@ -2436,12 +2436,18 @@ static void G_PrintFPS(void)
|
||||||
{
|
{
|
||||||
// adapted from ZDoom because I like it better than what we had
|
// adapted from ZDoom because I like it better than what we had
|
||||||
// applicable ZDoom code available under GPL from csDoom
|
// applicable ZDoom code available under GPL from csDoom
|
||||||
static int32_t FrameCount = 0;
|
static int32_t FrameCount = 0, LastCount = 0, LastSec = 0, LastMS = 0;
|
||||||
static int32_t LastCount = 0;
|
static int32_t MinFrames = INT32_MAX, MaxFrames = 0;
|
||||||
static int32_t LastSec = 0;
|
|
||||||
static int32_t LastMS = 0;
|
|
||||||
int32_t ms = getticks();
|
int32_t ms = getticks();
|
||||||
int32_t howlong = ms - LastMS;
|
int32_t howlong = ms - LastMS;
|
||||||
|
|
||||||
|
if (g_player[0].ps->player_par < 2)
|
||||||
|
{
|
||||||
|
MinFrames = INT32_MAX;
|
||||||
|
MaxFrames = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (howlong >= 0)
|
if (howlong >= 0)
|
||||||
{
|
{
|
||||||
int32_t thisSec = ms/1000;
|
int32_t thisSec = ms/1000;
|
||||||
|
@ -2455,14 +2461,29 @@ static void G_PrintFPS(void)
|
||||||
printext256(windowx2-(chars<<(3-x)),windowy1+1,
|
printext256(windowx2-(chars<<(3-x)),windowy1+1,
|
||||||
(LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
|
(LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
|
||||||
|
|
||||||
|
if (ud.tickrate > 1)
|
||||||
|
{
|
||||||
|
chars = Bsprintf(tempbuf, "max fps: %3u", MaxFrames);
|
||||||
|
|
||||||
|
printext256(windowx2-(chars<<(3-x))+1, windowy1+10+2, 0, -1, tempbuf, x);
|
||||||
|
printext256(windowx2-(chars<<(3-x)), windowy1+10,
|
||||||
|
(MaxFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x);
|
||||||
|
|
||||||
|
chars = Bsprintf(tempbuf, "min fps: %3u", MinFrames);
|
||||||
|
|
||||||
|
printext256(windowx2-(chars<<(3-x))+1, windowy1+20+2, 0, -1, tempbuf, x);
|
||||||
|
printext256(windowx2-(chars<<(3-x)), windowy1+20,
|
||||||
|
(MinFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x);
|
||||||
|
}
|
||||||
|
|
||||||
// lag meter
|
// lag meter
|
||||||
if (g_netClientPeer)
|
if (g_netClientPeer)
|
||||||
{
|
{
|
||||||
chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||||
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2);
|
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2);
|
||||||
|
|
||||||
printext256(windowx2-(chars<<(3-x))+1,windowy1+10+2,0,-1,tempbuf,x);
|
printext256(windowx2-(chars<<(3-x))+1,windowy1+30+2,0,-1,tempbuf,x);
|
||||||
printext256(windowx2-(chars<<(3-x)),windowy1+10+1,g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
|
printext256(windowx2-(chars<<(3-x)),windowy1+30+1,g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2471,6 +2492,12 @@ static void G_PrintFPS(void)
|
||||||
g_currentFrameRate = LastCount = FrameCount / (thisSec - LastSec);
|
g_currentFrameRate = LastCount = FrameCount / (thisSec - LastSec);
|
||||||
LastSec = thisSec;
|
LastSec = thisSec;
|
||||||
FrameCount = 0;
|
FrameCount = 0;
|
||||||
|
|
||||||
|
if (!osdshown)
|
||||||
|
{
|
||||||
|
if (LastCount > MaxFrames) MaxFrames = LastCount;
|
||||||
|
if (LastCount < MinFrames) MinFrames = LastCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FrameCount++;
|
FrameCount++;
|
||||||
}
|
}
|
||||||
|
@ -8422,7 +8449,9 @@ FOUNDCHEAT:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CHEAT_RATE:
|
case CHEAT_RATE:
|
||||||
ud.tickrate = !ud.tickrate;
|
if (ud.tickrate++ > 2)
|
||||||
|
ud.tickrate = 0;
|
||||||
|
|
||||||
end_cheat();
|
end_cheat();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1569,11 +1569,11 @@ int32_t registerosdcommands(void)
|
||||||
{ "mus_volume", "controls volume of midi music", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 },
|
{ "mus_volume", "controls volume of midi music", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 },
|
||||||
|
|
||||||
{ "osdhightile", "enable/disable hires art replacements for console text", (void *)&osdhightile, CVAR_BOOL, 0, 1 },
|
{ "osdhightile", "enable/disable hires art replacements for console text", (void *)&osdhightile, CVAR_BOOL, 0, 1 },
|
||||||
{ "osdscale", "adjust console text size", (void *)&osdscale, CVAR_FLOAT|CVAR_FUNCPTR, 1.f, 4.f },
|
{ "osdscale", "adjust console text size", (void *)&osdscale, CVAR_FLOAT|CVAR_FUNCPTR, 1, 4 },
|
||||||
|
|
||||||
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
|
{ "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 },
|
||||||
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
||||||
{ "r_showfps", "show the frame rate counter", (void *)&ud.tickrate, CVAR_BOOL, 0, 1 },
|
{ "r_showfps", "show the frame rate counter", (void *)&ud.tickrate, CVAR_INT, 0, 2 },
|
||||||
{ "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 },
|
{ "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 },
|
||||||
{ "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 },
|
{ "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 },
|
||||||
{ "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
{ "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||||
|
|
|
@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "premap.h"
|
#include "premap.h"
|
||||||
|
|
||||||
int32_t osdhightile = 1;
|
int32_t osdhightile = 1;
|
||||||
|
int32_t osdshown = 0;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
float osdscale = 2.f;
|
float osdscale = 2.f;
|
||||||
#else
|
#else
|
||||||
|
@ -127,7 +129,8 @@ void GAME_onshowosd(int32_t shown)
|
||||||
{
|
{
|
||||||
G_UpdateScreenArea();
|
G_UpdateScreenArea();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(shown);
|
osdshown = shown;
|
||||||
|
|
||||||
// XXX: it's weird to fake a keypress like this.
|
// XXX: it's weird to fake a keypress like this.
|
||||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||||
// KB_KeyDown[sc_Pause] = 1;
|
// KB_KeyDown[sc_Pause] = 1;
|
||||||
|
|
|
@ -29,6 +29,7 @@ void GAME_onshowosd(int32_t shown);
|
||||||
void GAME_clearbackground(int32_t numcols, int32_t numrows);
|
void GAME_clearbackground(int32_t numcols, int32_t numrows);
|
||||||
|
|
||||||
extern int32_t osdhightile;
|
extern int32_t osdhightile;
|
||||||
|
extern int32_t osdshown;
|
||||||
extern float osdscale;
|
extern float osdscale;
|
||||||
|
|
||||||
#define OSDCHAR_WIDTH 8
|
#define OSDCHAR_WIDTH 8
|
||||||
|
|
Loading…
Reference in a new issue