impr: Default to monitor synchronized FPS limit

This commit is contained in:
WerWolv
2023-04-13 17:12:40 +02:00
parent 1367e9cebe
commit 52925c99e8
5 changed files with 16 additions and 5 deletions

View File

@@ -265,7 +265,10 @@ namespace hex {
// Limit frame rate
const auto targetFps = ImHexApi::System::getTargetFPS();
if (targetFps <= 200) {
if (targetFps < 15) {
glfwSwapInterval(1);
} else if (targetFps <= 200) {
glfwSwapInterval(0);
auto leftoverFrameTime = i64((this->m_lastFrameTime + 1 / targetFps - glfwGetTime()) * 1000);
if (leftoverFrameTime > 0)
std::this_thread::sleep_for(std::chrono::milliseconds(leftoverFrameTime));