summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
diff options
context:
space:
mode:
authorGravatar jroweboy2019-09-22 15:40:57 +0200
committerGravatar FearlessTobi2019-09-22 15:49:39 +0200
commit64dbc92b614bfa388d31007788bf725c4e4b59e3 (patch)
tree45a929441460b900174e33b13f1997e8986d3507 /src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
parentMerge pull request #2867 from ReinUsesLisp/configure-framebuffers-clean (diff)
downloadyuzu-64dbc92b614bfa388d31007788bf725c4e4b59e3.tar.gz
yuzu-64dbc92b614bfa388d31007788bf725c4e4b59e3.tar.xz
yuzu-64dbc92b614bfa388d31007788bf725c4e4b59e3.zip
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)
Diffstat (limited to 'src/yuzu_cmd/emu_window/emu_window_sdl2.cpp')
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index a6edc089a..aa69cc9c8 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -4,6 +4,8 @@
4 4
5#include <SDL.h> 5#include <SDL.h>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "common/scm_rev.h"
8#include "core/core.h"
7#include "input_common/keyboard.h" 9#include "input_common/keyboard.h"
8#include "input_common/main.h" 10#include "input_common/main.h"
9#include "input_common/motion_emu.h" 11#include "input_common/motion_emu.h"
@@ -170,6 +172,16 @@ void EmuWindow_SDL2::PollEvents() {
170 break; 172 break;
171 } 173 }
172 } 174 }
175
176 const u32 current_time = SDL_GetTicks();
177 if (current_time > last_time + 2000) {
178 const auto results = Core::System::GetInstance().GetAndResetPerfStats();
179 const auto title = fmt::format(
180 "yuzu {} | {}-{} | FPS: {:.0f} ({:.0%})", Common::g_build_fullname,
181 Common::g_scm_branch, Common::g_scm_desc, results.game_fps, results.emulation_speed);
182 SDL_SetWindowTitle(render_window, title.c_str());
183 last_time = current_time;
184 }
173} 185}
174 186
175void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) { 187void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) {