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 <cmath>
|
||||||
#include "BaseRenderer.h"
|
#include "BaseRenderer.h"
|
||||||
#include "Console.h"
|
#include "Console.h"
|
||||||
|
#include "Ppu.h"
|
||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
|
|
||||||
BaseRenderer::BaseRenderer(shared_ptr<Console> console, bool registerAsMessageManager)
|
BaseRenderer::BaseRenderer(shared_ptr<Console> console, bool registerAsMessageManager)
|
||||||
|
@ -118,8 +119,8 @@ void BaseRenderer::ShowFpsCounter(int lineNumber)
|
||||||
int yPos = 13 + 24 * lineNumber;
|
int yPos = 13 + 24 * lineNumber;
|
||||||
if(_fpsTimer.GetElapsedMS() > 1000) {
|
if(_fpsTimer.GetElapsedMS() > 1000) {
|
||||||
//Update fps every sec
|
//Update fps every sec
|
||||||
//TODO
|
shared_ptr<Ppu> ppu = _console->GetPpu();
|
||||||
uint32_t frameCount = 0; //_console->GetFrameCount();
|
uint32_t frameCount = ppu ? ppu->GetState().FrameCount : 0;
|
||||||
if(_lastFrameCount > frameCount) {
|
if(_lastFrameCount > frameCount) {
|
||||||
_currentFPS = 0;
|
_currentFPS = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -161,24 +162,20 @@ void BaseRenderer::ShowGameTimer(int lineNumber)
|
||||||
DrawString(ss.str(), _screenWidth - 95, yPos, 250, 235, 215);*/
|
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)
|
void BaseRenderer::ShowFrameCounter(int lineNumber)
|
||||||
{
|
{
|
||||||
//TODO
|
int yPos = 13 + 24 * lineNumber;
|
||||||
/*int yPos = 13 + 24 * lineNumber;
|
shared_ptr<Ppu> ppu = _console->GetPpu();
|
||||||
string lagCounter = MessageManager::Localize("Frame") + ": " + std::to_string(_console->GetFrameCount());
|
|
||||||
DrawString(lagCounter, _screenWidth - 146, yPos, 250, 235, 215);*/
|
string frameCounter = MessageManager::Localize("Frame") + ": " + std::to_string(ppu ? ppu->GetState().FrameCount : 0);
|
||||||
|
DrawString(frameCounter, _screenWidth - 146, yPos, 250, 235, 215);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseRenderer::DrawCounters()
|
void BaseRenderer::DrawCounters()
|
||||||
{
|
{
|
||||||
|
int lineNumber = 0;
|
||||||
|
ShowFpsCounter(lineNumber++);
|
||||||
|
ShowFrameCounter(lineNumber++);
|
||||||
//TODO
|
//TODO
|
||||||
/*int lineNumber = 0;
|
/*int lineNumber = 0;
|
||||||
EmulationSettings* settings = _console->GetSettings();
|
EmulationSettings* settings = _console->GetSettings();
|
||||||
|
|
|
@ -167,6 +167,11 @@ shared_ptr<Debugger> Console::GetDebugger(bool autoStart)
|
||||||
return debugger;
|
return debugger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Console::IsRunning()
|
||||||
|
{
|
||||||
|
return _cpu != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void Console::ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type)
|
void Console::ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type)
|
||||||
{
|
{
|
||||||
if(_debugger) {
|
if(_debugger) {
|
||||||
|
|
|
@ -59,6 +59,8 @@ public:
|
||||||
shared_ptr<MemoryManager> GetMemoryManager();
|
shared_ptr<MemoryManager> GetMemoryManager();
|
||||||
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
shared_ptr<Debugger> GetDebugger(bool autoStart = true);
|
||||||
|
|
||||||
|
bool IsRunning();
|
||||||
|
|
||||||
void ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type);
|
void ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType type);
|
||||||
void ProcessCpuWrite(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) {
|
if(paused) {
|
||||||
DrawPauseScreen(disableOverlay);
|
DrawPauseScreen(disableOverlay);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if(_console->IsRunning()) {
|
if(_console->IsRunning()) {
|
||||||
DrawCounters();
|
DrawCounters();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
DrawToasts();
|
DrawToasts();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue