parent
d4948ebb46
commit
c9fb9cbe73
18
src/studio.c
18
src/studio.c
|
@ -2755,16 +2755,26 @@ s32 main(s32 argc, char **argv)
|
||||||
u64 nextTick = SDL_GetPerformanceCounter();
|
u64 nextTick = SDL_GetPerformanceCounter();
|
||||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
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)
|
while (!studio.quitFlag)
|
||||||
{
|
{
|
||||||
nextTick += Delta;
|
nextTick += Delta;
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
s64 delay = nextTick - SDL_GetPerformanceCounter();
|
if(noVsync || SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED)
|
||||||
|
{
|
||||||
|
s64 delay = nextTick - SDL_GetPerformanceCounter();
|
||||||
|
|
||||||
if(delay > 0)
|
if(delay > 0)
|
||||||
SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
||||||
else nextTick -= delay;
|
else nextTick -= delay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue