mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
HostInterface: Enable on-screen FPS/VPS/Speed display via config
This commit is contained in:
parent
9fd95c3e21
commit
7e36195f44
|
@ -207,13 +207,20 @@ bool HostInterface::ConfirmFormattedMessage(const char* format, ...)
|
||||||
return ConfirmMessage(message.c_str());
|
return ConfirmMessage(message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HostInterface::DrawImGuiWindows()
|
||||||
|
{
|
||||||
|
if (m_system)
|
||||||
|
{
|
||||||
|
DrawDebugWindows();
|
||||||
|
DrawFPSWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawOSDMessages();
|
||||||
|
}
|
||||||
|
|
||||||
void HostInterface::DrawFPSWindow()
|
void HostInterface::DrawFPSWindow()
|
||||||
{
|
{
|
||||||
const bool show_fps = true;
|
if (!(m_settings.display_show_fps | m_settings.display_show_vps | m_settings.display_show_speed))
|
||||||
const bool show_vps = true;
|
|
||||||
const bool show_speed = true;
|
|
||||||
|
|
||||||
if (!(show_fps | show_vps | show_speed) || !m_system)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ImVec2 window_size =
|
const ImVec2 window_size =
|
||||||
|
@ -231,12 +238,12 @@ void HostInterface::DrawFPSWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
if (show_fps)
|
if (m_settings.display_show_fps)
|
||||||
{
|
{
|
||||||
ImGui::Text("%.2f", m_system->GetFPS());
|
ImGui::Text("%.2f", m_system->GetFPS());
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if (show_vps)
|
if (m_settings.display_show_vps)
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +258,7 @@ void HostInterface::DrawFPSWindow()
|
||||||
|
|
||||||
ImGui::Text("%.2f", m_system->GetVPS());
|
ImGui::Text("%.2f", m_system->GetVPS());
|
||||||
}
|
}
|
||||||
if (show_speed)
|
if (m_settings.display_show_speed)
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
|
@ -330,6 +337,9 @@ void HostInterface::DrawOSDMessages()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_settings.display_show_osd_messages)
|
||||||
|
continue;
|
||||||
|
|
||||||
const float opacity = std::min(time_remaining, 1.0f);
|
const float opacity = std::min(time_remaining, 1.0f);
|
||||||
ImGui::SetNextWindowPos(ImVec2(position_x, position_y));
|
ImGui::SetNextWindowPos(ImVec2(position_x, position_y));
|
||||||
ImGui::SetNextWindowSize(ImVec2(0.0f, 0.0f));
|
ImGui::SetNextWindowSize(ImVec2(0.0f, 0.0f));
|
||||||
|
@ -861,6 +871,10 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||||
si.SetStringValue("Display", "CropMode", "Overscan");
|
si.SetStringValue("Display", "CropMode", "Overscan");
|
||||||
si.SetBoolValue("Display", "ForceProgressiveScan", true);
|
si.SetBoolValue("Display", "ForceProgressiveScan", true);
|
||||||
si.SetBoolValue("Display", "LinearFiltering", true);
|
si.SetBoolValue("Display", "LinearFiltering", true);
|
||||||
|
si.SetBoolValue("Display", "ShowOSDMessages", true);
|
||||||
|
si.SetBoolValue("Display", "ShowFPS", false);
|
||||||
|
si.SetBoolValue("Display", "ShowVPS", false);
|
||||||
|
si.SetBoolValue("Display", "ShowSpeed", false);
|
||||||
si.SetBoolValue("Display", "Fullscreen", false);
|
si.SetBoolValue("Display", "Fullscreen", false);
|
||||||
si.SetBoolValue("Display", "VSync", true);
|
si.SetBoolValue("Display", "VSync", true);
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,7 @@ protected:
|
||||||
virtual void OnSystemStateSaved(bool global, s32 slot);
|
virtual void OnSystemStateSaved(bool global, s32 slot);
|
||||||
virtual void OnRunningGameChanged();
|
virtual void OnRunningGameChanged();
|
||||||
virtual void OnControllerTypeChanged(u32 slot);
|
virtual void OnControllerTypeChanged(u32 slot);
|
||||||
|
virtual void DrawImGuiWindows();
|
||||||
|
|
||||||
void SetUserDirectory();
|
void SetUserDirectory();
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ void Settings::Load(SettingsInterface& si)
|
||||||
.value_or(DisplayCropMode::None);
|
.value_or(DisplayCropMode::None);
|
||||||
display_force_progressive_scan = si.GetBoolValue("Display", "ForceProgressiveScan", true);
|
display_force_progressive_scan = si.GetBoolValue("Display", "ForceProgressiveScan", true);
|
||||||
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
||||||
|
display_show_osd_messages = si.GetBoolValue("Display", "ShowOSDMessages", true);
|
||||||
|
display_show_fps = si.GetBoolValue("Display", "ShowFPS", false);
|
||||||
|
display_show_vps = si.GetBoolValue("Display", "ShowVPS", false);
|
||||||
|
display_show_speed = si.GetBoolValue("Display", "ShowSpeed", false);
|
||||||
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
||||||
|
|
||||||
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
||||||
|
@ -87,6 +91,10 @@ void Settings::Save(SettingsInterface& si) const
|
||||||
|
|
||||||
si.SetBoolValue("Display", "ForceProgressiveScan", display_force_progressive_scan);
|
si.SetBoolValue("Display", "ForceProgressiveScan", display_force_progressive_scan);
|
||||||
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
||||||
|
si.SetBoolValue("Display", "ShowOSDMessages", display_show_osd_messages);
|
||||||
|
si.SetBoolValue("Display", "ShowFPS", display_show_fps);
|
||||||
|
si.SetBoolValue("Display", "ShowVPS", display_show_vps);
|
||||||
|
si.SetBoolValue("Display", "ShowSpeed", display_show_speed);
|
||||||
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
||||||
|
|
||||||
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
||||||
|
|
|
@ -54,6 +54,10 @@ struct Settings
|
||||||
DisplayCropMode display_crop_mode = DisplayCropMode::None;
|
DisplayCropMode display_crop_mode = DisplayCropMode::None;
|
||||||
bool display_force_progressive_scan = false;
|
bool display_force_progressive_scan = false;
|
||||||
bool display_linear_filtering = true;
|
bool display_linear_filtering = true;
|
||||||
|
bool display_show_osd_messages = false;
|
||||||
|
bool display_show_fps = false;
|
||||||
|
bool display_show_vps = false;
|
||||||
|
bool display_show_speed = false;
|
||||||
bool video_sync_enabled = true;
|
bool video_sync_enabled = true;
|
||||||
|
|
||||||
bool cdrom_read_thread = true;
|
bool cdrom_read_thread = true;
|
||||||
|
|
|
@ -741,8 +741,7 @@ void QtHostInterface::renderDisplay()
|
||||||
{
|
{
|
||||||
m_system->GetGPU()->ResetGraphicsAPIState();
|
m_system->GetGPU()->ResetGraphicsAPIState();
|
||||||
|
|
||||||
DrawDebugWindows();
|
DrawImGuiWindows();
|
||||||
DrawOSDMessages();
|
|
||||||
|
|
||||||
m_display->Render();
|
m_display->Render();
|
||||||
|
|
||||||
|
|
|
@ -613,13 +613,13 @@ bool SDLHostInterface::HandleSDLKeyEventForController(const SDL_Event* event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLHostInterface::DrawImGui()
|
void SDLHostInterface::DrawImGuiWindows()
|
||||||
{
|
{
|
||||||
DrawMainMenuBar();
|
DrawMainMenuBar();
|
||||||
|
|
||||||
if (m_system)
|
HostInterface::DrawImGuiWindows();
|
||||||
DrawDebugWindows();
|
|
||||||
else
|
if (!m_system)
|
||||||
DrawPoweredOffWindow();
|
DrawPoweredOffWindow();
|
||||||
|
|
||||||
if (m_settings_window_open)
|
if (m_settings_window_open)
|
||||||
|
@ -628,8 +628,6 @@ void SDLHostInterface::DrawImGui()
|
||||||
if (m_about_window_open)
|
if (m_about_window_open)
|
||||||
DrawAboutWindow();
|
DrawAboutWindow();
|
||||||
|
|
||||||
DrawOSDMessages();
|
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1430,7 +1428,7 @@ void SDLHostInterface::Run()
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
{
|
{
|
||||||
DrawImGui();
|
DrawImGuiWindows();
|
||||||
|
|
||||||
if (m_system)
|
if (m_system)
|
||||||
m_system->GetGPU()->ResetGraphicsAPIState();
|
m_system->GetGPU()->ResetGraphicsAPIState();
|
||||||
|
|
|
@ -98,7 +98,7 @@ private:
|
||||||
void SetFullscreen(bool enabled);
|
void SetFullscreen(bool enabled);
|
||||||
|
|
||||||
// We only pass mouse input through if it's grabbed
|
// We only pass mouse input through if it's grabbed
|
||||||
void DrawImGui();
|
void DrawImGuiWindows() override;
|
||||||
void DoStartDisc();
|
void DoStartDisc();
|
||||||
void DoChangeDisc();
|
void DoChangeDisc();
|
||||||
void DoFrameStep();
|
void DoFrameStep();
|
||||||
|
|
Loading…
Reference in a new issue