dentro de interface.h
Código:
class Interface
{
public:
//FPS PRIMEIRO TESTE:
int lastReport;
int frameCount;
int frameRate;
char FPS_REAL[30];
void UPDATE_FPS();
void guiMonitore();
private:
};
extern Interface gInterface;
em interface.cpp
Código:
void Interface::UPDATE_FPS(){
gInterface.frameCount++;
if (GetTickCount() - gInterface.lastReport >= 1000)
{
gInterface.frameRate = gInterface.frameCount / ((GetTickCount() - gInterface.lastReport) / 1000);
sprintf(gInterface.FPS_REAL, "FPS: %d", gInterface.frameRate);
gInterface.lastReport = GetTickCount();
gInterface.frameCount = 0;
}
// ======================================================================
if (this->MiniMapCheck() || this->CombinedChecks() )
{
return;
}
this->DrawFormat(eGold, 600, 5, 80, 1, gInterface.FPS_REAL);
}
void Interface::guiMonitore(){
if (this->MiniMapCheck() || this->CombinedChecks() )
{
return;
}
pSetBlend(true);
glColor4f((GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (float)0.8);
pDrawBarForm(495.0, 0.0, 150.0, 20.0, 0.0f, 0);
pGLSwitchBlend();
}
executar dentro de work()
Código:
gInterface.guiMonitore();
gInterface.UPDATE_FPS();
no main ao iniciar dentro da função principal
Código:
gInterface.lastReport = GetTickCount();
gInterface.frameCount = 0;
Créditos:
takumi12