UI: Added frame/fps counters
This commit is contained in:
parent
d12a582dbc
commit
1224909fb1
4 changed files with 20 additions and 16 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <cmath>
|
||||
#include "BaseRenderer.h"
|
||||
#include "Console.h"
|
||||
#include "Ppu.h"
|
||||
#include "MessageManager.h"
|
||||
|
||||
BaseRenderer::BaseRenderer(shared_ptr<Console> console, bool registerAsMessageManager)
|
||||
|
@ -118,8 +119,8 @@ void BaseRenderer::ShowFpsCounter(int lineNumber)
|
|||
int yPos = 13 + 24 * lineNumber;
|
||||
if(_fpsTimer.GetElapsedMS() > 1000) {
|
||||
//Update fps every sec
|
||||
//TODO
|
||||
uint32_t frameCount = 0; //_console->GetFrameCount();
|
||||
shared_ptr<Ppu> ppu = _console->GetPpu();
|
||||
uint32_t frameCount = ppu ? ppu->GetState().FrameCount : 0;
|
||||
if(_lastFrameCount > frameCount) {
|
||||
_currentFPS = 0;
|
||||
} else {
|
||||
|
@ -161,24 +162,20 @@ void BaseRenderer::ShowGameTimer(int lineNumber)
|
|||
DrawString(ss.str(), _screenWidth - 95, yPos, 250, 235, 215);*/
|
||||
}
|
||||
|
||||
void BaseRenderer::ShowLagCounter(int lineNumber)
|
||||
{
|
||||
//TODO
|
||||
/*int yPos = 13 + 24 * lineNumber;
|
||||
string lagCounter = MessageManager::Localize("Lag") + ": " + std::to_string(_console->GetLagCounter());
|
||||
DrawString(lagCounter, _screenWidth - 123, yPos, 250, 235, 215);*/
|
||||
}
|
||||
|
||||
void BaseRenderer::ShowFrameCounter(int lineNumber)
|
||||
{
|
||||
//TODO
|
||||
/*int yPos = 13 + 24 * lineNumber;
|
||||
string lagCounter = MessageManager::Localize("Frame") + ": " + std::to_string(_console->GetFrameCount());
|
||||
DrawString(lagCounter, _screenWidth - 146, yPos, 250, 235, 215);*/
|
||||
int yPos = 13 + 24 * lineNumber;
|
||||
shared_ptr<Ppu> ppu = _console->GetPpu();
|
||||
|
||||
string frameCounter = MessageManager::Localize("Frame") + ": " + std::to_string(ppu ? ppu->GetState().FrameCount : 0);
|
||||
DrawString(frameCounter, _screenWidth - 146, yPos, 250, 235, 215);
|
||||
}
|
||||
|
||||
void BaseRenderer::DrawCounters()
|
||||
{
|
||||
int lineNumber = 0;
|
||||
ShowFpsCounter(lineNumber++);
|
||||
ShowFrameCounter(lineNumber++);
|
||||
//TODO
|
||||
/*int lineNumber = 0;
|
||||
EmulationSettings* settings = _console->GetSettings();
|
||||
|
|
|
@ -167,6 +167,11 @@ shared_ptr<Debugger> Console::GetDebugger(bool autoStart)
|
|||
return debugger;
|
||||
}
|
||||
|
||||
bool Console::IsRunning()
|
||||
{
|
||||
return _cpu != nullptr;
|
||||
}
|
||||
|
||||
void Console::ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type)
|
||||
{
|
||||
if(_debugger) {
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
shared_ptr<MemoryManager> GetMemoryManager();
|
||||
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
||||
|
||||
bool IsRunning();
|
||||
|
||||
void ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type);
|
||||
void ProcessCpuWrite(uint32_t addr, uint8_t value, MemoryOperationType type);
|
||||
};
|
|
@ -626,10 +626,10 @@ void Renderer::Render()
|
|||
if(paused) {
|
||||
DrawPauseScreen(disableOverlay);
|
||||
}
|
||||
|
||||
*/
|
||||
if(_console->IsRunning()) {
|
||||
DrawCounters();
|
||||
}*/
|
||||
}
|
||||
|
||||
DrawToasts();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue