Workaround MSVC bug causing spin in pause menu.

It seems to get the result -0.000, and not sleep at all...
Forcing it to an int fixes it.
This commit is contained in:
Unknown W. Brackets 2013-04-28 16:41:38 -07:00
parent 31f9d69e5a
commit cb15c1ef96

View File

@ -134,9 +134,10 @@ void Core_RunLoop()
// Simple throttling to not burn the GPU in the menu.
#ifdef _WIN32
if (globalUIState != UISTATE_INGAME) {
double sleepTime = 16.666 - (time_now_d() - startTime) * 1000.0;
if (sleepTime > 0.0)
Sleep((int)sleepTime);
double diffTime = time_now_d() - startTime;
int sleepTime = (int) (1000000.0 / 60.0) - (int) (diffTime * 1000000.0);
if (sleepTime > 0)
Sleep(sleepTime / 1000);
GL_SwapBuffers();
} else if (!Core_IsStepping()) {
GL_SwapBuffers();