diff --git a/DumpDVD/Gui/MainWindow.cpp b/DumpDVD/Gui/MainWindow.cpp index b32905c..55180ef 100644 --- a/DumpDVD/Gui/MainWindow.cpp +++ b/DumpDVD/Gui/MainWindow.cpp @@ -23,12 +23,17 @@ namespace Li::Gui { DumpDVD* dumpDvdMenu = new DumpDVD(); while (!this->sdl->IsExiting()) { + uint64_t start = SDL_GetPerformanceCounter(); this->sdl->PollEvent(); this->sdl->NewFrame(); dumpDvdMenu->RenderUI(); this->sdl->Render(); + uint64_t end = SDL_GetPerformanceCounter(); + float elapsedMS = (end - start) / (float)SDL_GetPerformanceFrequency() * 1000.0f; + // Cap to 60 FPS + SDL_Delay(floor(16.666f - elapsedMS)); } delete dumpDvdMenu;