Merge pull request #4950 from jroweboy/sdl-title
Add FPS to SDL title bar
This commit is contained in:
commit
cf40735269
@ -346,8 +346,6 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system{Core::System::GetInstance()};
|
||||||
|
|
||||||
SCOPE_EXIT({ system.Shutdown(); });
|
|
||||||
|
|
||||||
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
|
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
|
||||||
|
|
||||||
switch (load_result) {
|
switch (load_result) {
|
||||||
@ -418,6 +416,8 @@ int main(int argc, char** argv) {
|
|||||||
system.VideoDumper().StopDumping();
|
system.VideoDumper().StopDumping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
system.Shutdown();
|
||||||
|
|
||||||
detached_tasks.WaitForAllTasks();
|
detached_tasks.WaitForAllTasks();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "core/3ds.h"
|
#include "core/3ds.h"
|
||||||
|
#include "core/core.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/keyboard.h"
|
#include "input_common/keyboard.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
@ -242,6 +243,16 @@ void EmuWindow_SDL2::PollEvents() {
|
|||||||
break;
|
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() {
|
void EmuWindow_SDL2::MakeCurrent() {
|
||||||
|
@ -70,4 +70,7 @@ private:
|
|||||||
using SDL_GLContext = void*;
|
using SDL_GLContext = void*;
|
||||||
/// The OpenGL context associated with the window
|
/// The OpenGL context associated with the window
|
||||||
SDL_GLContext gl_context;
|
SDL_GLContext gl_context;
|
||||||
|
|
||||||
|
/// Keeps track of how often to update the title bar during gameplay
|
||||||
|
u32 last_time = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user