Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/main.cpp
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
if (g_VideoMode.IsVSyncEnabled()) | if (g_VideoMode.IsVSyncEnabled()) | ||||
return; | return; | ||||
double fpsLimit = 0.0; | double fpsLimit = 0.0; | ||||
CFG_GET_VAL(g_Game && g_Game->IsGameStarted() ? "adaptivefps.session" : "adaptivefps.menu", fpsLimit); | CFG_GET_VAL(g_Game && g_Game->IsGameStarted() ? "adaptivefps.session" : "adaptivefps.menu", fpsLimit); | ||||
// Keep in sync with options.json | // Keep in sync with options.json | ||||
if (fpsLimit < 20.0 || fpsLimit >= 100.0) | if (fpsLimit < 20.0 || fpsLimit >= 360.0) | ||||
return; | return; | ||||
double wait = 1000.0 / fpsLimit - | double wait = 1000.0 / fpsLimit - | ||||
std::chrono::duration_cast<std::chrono::microseconds>( | std::chrono::duration_cast<std::chrono::microseconds>( | ||||
std::chrono::high_resolution_clock::now() - lastFrameTime).count() / 1000.0; | std::chrono::high_resolution_clock::now() - lastFrameTime).count() / 1000.0; | ||||
if (wait > 0.0) | if (wait > 0.0) | ||||
SDL_Delay(wait); | SDL_Delay(wait); | ||||
▲ Show 20 Lines • Show All 457 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator