SDL: Fix FPS counter disappearing behind menu

This commit is contained in:
Connor McLaughlin 2019-09-26 23:27:57 +10:00
parent e9bb3d79b8
commit b75674b149
2 changed files with 4 additions and 23 deletions

View file

@ -392,7 +392,6 @@ void SDLInterface::RenderImGui()
m_system->RenderUI();
RenderOSDMessages();
RenderFPS();
ImGui::Render();
}
@ -450,6 +449,10 @@ void SDLInterface::RenderMainMenuBar()
ImGui::EndMenu();
}
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 80.0f);
ImGui::Text("FPS: %.2f", m_fps);
ImGui::EndMainMenuBar();
}
@ -514,27 +517,6 @@ void SDLInterface::RenderOSDMessages()
}
}
void SDLInterface::RenderFPS()
{
// Position in the top-right corner of the screen.
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - 2.0f, 2.0f), ImGuiCond_Always, ImVec2(1.0f, 0.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
ImGui::SetNextWindowSize(ImVec2(80.0f, 20.0f));
if (ImGui::Begin("FPS", nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav |
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing |
ImGuiWindowFlags_NoBackground))
{
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), "FPS: %.2f", m_fps);
}
ImGui::End();
ImGui::PopStyleVar(2);
}
void SDLInterface::DoLoadState(u32 index)
{
LoadState(GetSaveStateFilename(index));

View file

@ -57,7 +57,6 @@ private:
void RenderDisplay();
void RenderMainMenuBar();
void RenderOSDMessages();
void RenderFPS();
SDL_Window* m_window = nullptr;
SDL_GLContext m_gl_context = nullptr;