1
0
mirror of synced 2025-01-10 21:41:53 +01:00

impr: Unlock frame rate in more cases to make the UI feel more responsive

This commit is contained in:
WerWolv 2025-01-06 20:34:00 +01:00
parent cb34f68b1b
commit ae4dde8255

View File

@ -268,6 +268,24 @@ namespace hex {
}
m_lastFrameTime = glfwGetTime() - m_lastStartFrameTime;
// Unlock frame rate if any mouse button is being held down to allow drag scrolling to be smooth
if (ImGui::IsAnyMouseDown())
m_unlockFrameRate = true;
// Unlock frame rate if any modifier key is held down since they don't generate key repeat events
if (
ImGui::IsKeyPressed(ImGuiKey_LeftCtrl) || ImGui::IsKeyPressed(ImGuiKey_RightCtrl) ||
ImGui::IsKeyPressed(ImGuiKey_LeftShift) || ImGui::IsKeyPressed(ImGuiKey_RightShift) ||
ImGui::IsKeyPressed(ImGuiKey_LeftSuper) || ImGui::IsKeyPressed(ImGuiKey_RightSuper) ||
ImGui::IsKeyPressed(ImGuiKey_LeftAlt) || ImGui::IsKeyPressed(ImGuiKey_RightAlt)
) {
m_unlockFrameRate = true;
}
// Unlock frame rate if there's more than one viewport since these don't call the glfw callbacks registered here
if (ImGui::GetPlatformIO().Viewports.size() > 1)
m_unlockFrameRate = true;
}
// Hide the window as soon as the render loop exits to make the window