FPS/Ping & More FOV Codes
#15


1 hour ago, WhosUrDaddi said:




please dont use all that code thats a mess



from that code above the only lines you need is


FLOAT fFPS = 0.0f;
extern ENGINE_API INDEX cli_iCurrentFPS;
fFPS = cli_iCurrentFPS;

CTString strFPS = "?";
CTString strRomain = "?";
if (fFPS >= 30)
strFPS.PrintF("%3.0f", fFPS);
else if (fFPS >= 0.1f)
strFPS.PrintF("%3.1f", fFPS);

strRomain.PrintF("LastChaos - FPS");
pDrawPort->PutTextExCX(strRomain, m_nPosX + this->GetWidth() / 2 , m_nLocalTimeY + 224, 0xFFFFFFFF);
pDrawPort->PutTextExCX(strFPS, m_nPosX + this->GetWidth() / 2 , m_nLocalTimeY + 244, 0x4BE100FF);


Oop sorry thats only if you have the hud_iStats enabled but without that it would also be less code

// timer variables
#define FRAMES_AVERAGING_MAX 20L
static CTimerValue _tvLasts[FRAMES_AVERAGING_MAX];
static CTimerValue _tvDelta[FRAMES_AVERAGING_MAX];
static INDEX _iCheckNow = 0;
static INDEX _iCheckMax = 0;

// calculate FPS
FLOAT fFPS = 0.0f;
_iCheckMax++;
if (_iCheckMax >= FRAMES_AVERAGING_MAX) {
for (INDEX i = 0; i<FRAMES_AVERAGING_MAX; i++) fFPS += _tvDelta[i].GetSeconds();
fFPS = FRAMES_AVERAGING_MAX*FRAMES_AVERAGING_MAX / fFPS;
_iCheckMax = FRAMES_AVERAGING_MAX;
}

// determine newest time
CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
_tvDelta[_iCheckNow] = tvNow - _tvLasts[_iCheckNow];
_tvLasts[_iCheckNow] = tvNow;
_iCheckNow = (_iCheckNow + 1) % FRAMES_AVERAGING_MAX;

// display colored FPS
COLOR colFPS = C_RED;
if (fFPS >= 20)
colFPS = C_GREEN;

if (fFPS >= 60)
colFPS = C_WHITE;

CTString strFPS = "?";
CTString strRomain = "?";
if (fFPS >= 30)
strFPS.PrintF("%3.0f", fFPS);
else if (fFPS >= 0.1f)
strFPS.PrintF("%3.1f", fFPS);

strRomain.PrintF("LastChaos - FPS");
pDrawPort->PutTextExCX(strRomain, m_nPosX + this->GetWidth() / 2 , m_nLocalTimeY + 224, 0xFFFFFFFF);
pDrawPort->PutTextExCX(strFPS, m_nPosX + this->GetWidth() / 2 , m_nLocalTimeY + 244, 0x4BE100FF);

 



Messages In This Thread
[No subject] - by nicolasg - 03-24-2022, 01:04 AM
[No subject] - by Desarija - 03-24-2022, 01:56 PM
[No subject] - by nicolasg - 03-24-2022, 07:26 PM
[No subject] - by WhosUrDaddi - 03-24-2022, 08:29 PM
[No subject] - by nicolasg - 03-25-2022, 12:38 AM
[No subject] - by Desarija - 03-25-2022, 12:47 AM
[No subject] - by nicolasg - 03-25-2022, 01:06 AM
[No subject] - by Exodus - 03-25-2022, 11:01 AM
[No subject] - by nicolasg - 03-25-2022, 12:18 PM
[No subject] - by deudas - 01-28-2023, 10:22 PM
[No subject] - by nicolasg - 01-28-2023, 10:26 PM
[No subject] - by Desarija - 01-28-2023, 10:34 PM
[No subject] - by deudas - 01-28-2023, 10:50 PM
[No subject] - by WhosUrDaddi - 01-30-2023, 08:32 PM
[No subject] - by WhosUrDaddi - 01-30-2023, 09:42 PM
[No subject] - by Stormax - 01-31-2023, 11:00 AM
[No subject] - by nicolasg - 01-31-2023, 11:05 AM
[No subject] - by Stormax - 01-31-2023, 11:39 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)