01-31-2023, 11:05 AM
7 minutes ago, Stormax said:
pDrawPort->PutTextExCX( strServerInfo, m_nPosX +this->GetWidth()/2 + 50, m_nLocalTimeY + 17, 0xFFA600FF );
Don't exist on november source have you a solution?
in my case, I call a function inside
void CUIRadar::OnUpdate
to update the fps value.
I leave the function in case anyone is interested, they would have to add the CUIText to their xml and do the corresponding thing in the source
// NICOLASG MARK (SHOW FPS)
void CUIRadar::updateFPSCounter(){
if(m_pTxtFpsInfo == NULL)
return;
#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;
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;
}
CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
_tvDelta[_iCheckNow] = tvNow - _tvLasts[_iCheckNow];
_tvLasts[_iCheckNow] = tvNow;
_iCheckNow = (_iCheckNow + 1) % FRAMES_AVERAGING_MAX;
CTString strFPS = "";
if(fFPS >= 30) strFPS.PrintF("FPS: %3.0f", fFPS);
else if(fFPS >= 0.1f) strFPS.PrintF("FPS: %3.1f", fFPS);
m_pTxtFpsInfo->SetText(strFPS);
}
// NICOLASG MARK END

