Games get desynced #491

removed timer using with VSYNC together
This commit is contained in:
BADIM-PC\Vadim 2017-12-31 13:15:05 +03:00
parent d4948ebb46
commit c9fb9cbe73
1 changed files with 14 additions and 4 deletions

View File

@ -2755,11 +2755,20 @@ s32 main(s32 argc, char **argv)
u64 nextTick = SDL_GetPerformanceCounter();
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
bool noVsync = false;
{
SDL_RendererInfo info;
SDL_GetRendererInfo(studio.renderer, &info);
noVsync = info.flags & SDL_RENDERER_PRESENTVSYNC ? false : true;
}
while (!studio.quitFlag)
{
nextTick += Delta;
tick();
if(noVsync || SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED)
{
s64 delay = nextTick - SDL_GetPerformanceCounter();
if(delay > 0)
@ -2767,6 +2776,7 @@ s32 main(s32 argc, char **argv)
else nextTick -= delay;
}
}
}
#endif