Add FPS to SDL title bar

Also fix a small issue with incorrect shutdown ordering in SDL.
Previously the system would still be running so the telemetry task
didn't launch and detached_tasks would assert(count == 0)
This commit is contained in:
James Rowe 2019-09-21 21:39:01 -06:00
parent 223bfc9a2a
commit 7152f4c748
3 changed files with 16 additions and 2 deletions

View file

@ -13,6 +13,7 @@
#include "common/logging/log.h"
#include "common/scm_rev.h"
#include "core/3ds.h"
#include "core/core.h"
#include "core/settings.h"
#include "input_common/keyboard.h"
#include "input_common/main.h"
@ -242,6 +243,16 @@ void EmuWindow_SDL2::PollEvents() {
break;
}
}
const u32 current_time = SDL_GetTicks();
if (current_time > last_time + 2000) {
const auto results = Core::System::GetInstance().GetAndResetPerfStats();
const auto title = fmt::format(
"Citra {} | {}-{} | FPS: {:.0f} ({:.0%})", Common::g_build_fullname,
Common::g_scm_branch, Common::g_scm_desc, results.game_fps, results.emulation_speed);
SDL_SetWindowTitle(render_window, title.c_str());
last_time = current_time;
}
}
void EmuWindow_SDL2::MakeCurrent() {