Limit FPS to 60fps
This commit is contained in:
parent
b6f21843d0
commit
d3e8c9a343
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue