Merge pull request #3106 from lioncash/fps

FPSCounter: Minor changes
This commit is contained in:
flacs 2015-09-29 16:07:37 +02:00
commit e278587023
4 changed files with 10 additions and 15 deletions

View File

@ -41,7 +41,6 @@
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PixelEngine.h"

View File

@ -10,12 +10,9 @@
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/VideoConfig.h"
#define FPS_REFRESH_INTERVAL 1000
static constexpr u64 FPS_REFRESH_INTERVAL = 1000;
FPSCounter::FPSCounter()
: m_fps(0)
, m_counter(0)
, m_fps_last_counter(0)
{
m_update_time.Update();
m_render_time.Update();
@ -29,7 +26,7 @@ void FPSCounter::LogRenderTimeToFile(u64 val)
m_bench_file << val << std::endl;
}
int FPSCounter::Update()
void FPSCounter::Update()
{
if (m_update_time.GetTimeDifference() >= FPS_REFRESH_INTERVAL)
{
@ -46,5 +43,4 @@ int FPSCounter::Update()
}
m_counter++;
return m_fps;
}

View File

@ -11,18 +11,18 @@
class FPSCounter
{
public:
unsigned int m_fps;
// Initializes the FPS counter.
FPSCounter();
// Called when a frame is rendered. Returns the value to be displayed on
// screen as the FPS counter (updated every second).
int Update();
// Called when a frame is rendered (updated every second).
void Update();
unsigned int GetFPS() const { return m_fps; }
private:
unsigned int m_counter;
unsigned int m_fps_last_counter;
unsigned int m_fps = 0;
unsigned int m_counter = 0;
unsigned int m_fps_last_counter = 0;
Common::Timer m_update_time;
Common::Timer m_render_time;

View File

@ -295,7 +295,7 @@ void Renderer::DrawDebugText()
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
{
if (g_ActiveConfig.bShowFPS)
final_cyan += StringFromFormat("FPS: %d", g_renderer->m_fps_counter.m_fps);
final_cyan += StringFromFormat("FPS: %u", g_renderer->m_fps_counter.GetFPS());
if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
final_cyan += " - ";