fix: Frame rate not unlocking correctly (#890)

m_hadEvent could be set during glfwWaitEventsTimeout and then
immediately cleared before ever being checked.
This commit is contained in:
birdstakes
2023-01-17 02:14:40 -05:00
committed by GitHub
parent 92f0aa9593
commit ca68150970

View File

@@ -212,6 +212,7 @@ namespace hex {
bool frameRateUnlocked = ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId) || TaskManager::getRunningTaskCount() > 0 || this->m_mouseButtonDown || this->m_hadEvent || !this->m_pressedKeys.empty();
const double timeout = std::max(0.0, (1.0 / 5.0) - (glfwGetTime() - this->m_lastFrameTime));
this->m_hadEvent = false;
if ((this->m_lastFrameTime - this->m_frameRateUnlockTime) > 5 && this->m_frameRateTemporarilyUnlocked && !frameRateUnlocked) {
this->m_frameRateTemporarilyUnlocked = false;
@@ -239,8 +240,6 @@ namespace hex {
}
this->m_lastFrameTime = glfwGetTime();
this->m_hadEvent = false;
}
}