twn_loop.c: place SDL_Delay() to not waste CPU time

This commit is contained in:
veclavtalica 2025-01-26 12:06:00 +03:00
parent f365cff590
commit cf8227d7d3

View File

@ -252,6 +252,10 @@ 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
/* 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);
}