twn_loop.c: limit minimum amount of delay

This commit is contained in:
veclavtalica 2025-01-26 18:34:34 +03:00
parent 3bdee30e7b
commit a54657e7be

View File

@ -252,7 +252,7 @@ static void main_loop(void) {
/* which for now is broken as glBufferData with NULL is used all over right after render */
if (frames != 0)
render();
else
else if (ctx.desired_frametime - ctx.frame_accumulator > 1000000)
/* don't waste clock cycles on useless work */
/* TODO: make it adjustable from config */
SDL_Delay((uint32_t)(ctx.desired_frametime - ctx.frame_accumulator) / 1250000);