PDA

View Full Version : |Source| Monitorar FPS na tela, de código básico.



Goten
05/03/2020, 07:35 PM
[Only registered and activated users can see links]

dentro de interface.h

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

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()

gInterface.guiMonitore();
gInterface.UPDATE_FPS();

no main ao iniciar dentro da função principal

gInterface.lastReport = GetTickCount();
gInterface.frameCount = 0;

Créditos:
takumi12

Linkzr
06/03/2020, 12:55 AM
Lá no fórum aonde foi originalmente postado pelo takumi12, ele fala que é só uma melhor forma de exibir o FPS e PING de acordo com outro tópico...
Pra funcionar corretamente precisa criar também uma função na source do game server.

Mentor
06/03/2020, 12:37 PM
Irei testar mais acho que essa quantidade toda de código nao é apenas para posicionar a caixinha.
A função já está ai dentro da interface.cpp

Mentor
06/03/2020, 09:37 PM
Adicionei o código a minha fonte e tive alguns problemas tanto na interface season2 como na interface season6, no caso da season2 é pior que alem de não exibir o FPS, está bugando a interface como mostra na imagem abaixo:
[Only registered and activated users can see links]

Na season6 não exibi o FPS:
[Only registered and activated users can see links]

Eu notei que esse problema ocorre quando utilizo o gInterface.guiMonitore(); responsável pelo bg escuro onde fica o FPS, após comentar a linha o FPS é exibido sem o fundo escuro.

[Only registered and activated users can see links]

Linkzr
08/03/2020, 01:22 PM
interface.h


bool MiniMapCheck();
bool CombinedChecks();


interface.cpp


bool Interface::MiniMapCheck()
{
if (this->CheckWindow(Inventory) ||
this->CheckWindow(CashShop) ||
this->CheckWindow(ChaosBox) ||
this->CheckWindow(Character) ||
this->CheckWindow(CommandWindow) ||
this->CheckWindow(ExpandInventory) ||
this->CheckWindow(ExpandWarehouse) ||
this->CheckWindow(FullMap) ||
this->CheckWindow(GensInfo) ||
this->CheckWindow(Guild) ||
this->CheckWindow(NPC_Dialog) ||
this->CheckWindow(NPC_Julia) ||
this->CheckWindow(NPC_Titus) ||
this->CheckWindow(OtherStore) ||
this->CheckWindow(Party) ||
this->CheckWindow(PetInfo) ||
this->CheckWindow(Shop) ||
this->CheckWindow(SkillTree) ||
this->CheckWindow(Store) ||
this->CheckWindow(Trade) ||
this->CheckWindow(FriendList) ||
this->CheckWindow(FastMenu) ||
this->CheckWindow(MuHelper) ||
this->CheckWindow(Quest) ||
this->CheckWindow(Lugard) ||
this->CheckWindow(Jerint) ||
this->CheckWindow(GoldenArcher1) ||
this->CheckWindow(GoldenArcher2) ||
this->CheckWindow(LuckyCoin1) ||
this->CheckWindow(LuckyCoin2) ||
this->CheckWindow(NPC_Duel) ||
this->CheckWindow(NPC_Devin) ||
this->CheckWindow(GuardNPC) ||
this->CheckWindow(SeniorNPC) ||
this->CheckWindow(GuardNPC2) ||
this->CheckWindow(CastleGateSwitch) ||
this->CheckWindow(CatapultNPC) ||
this->CheckWindow(CreateGuild) ||
this->CheckWindow(Warehouse))
return true;
return false;
}

bool Interface::CombinedChecks()
{
if ((this->CheckWindow(Inventory)
&& this->CheckWindow(ExpandInventory)
&& this->CheckWindow(Store)) ||
(this->CheckWindow(Inventory)
&& this->CheckWindow(Warehouse)
&& this->CheckWindow(ExpandWarehouse)) ||
(this->CheckWindow(Inventory)
&& this->CheckWindow(Character)
&& this->CheckWindow(Store)))
return true;
return false;
}

Stark
30/03/2020, 07:49 PM
Não funciona na 97d né?

Linkzr
30/03/2020, 09:08 PM
os códigos só dão para serem utilizados em Sources MuEMU