twn_loop.c: place SDL_Delay() to not waste CPU time
This commit is contained in:
parent
f365cff590
commit
cf8227d7d3
@ -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 */
|
/* which for now is broken as glBufferData with NULL is used all over right after render */
|
||||||
if (frames != 0)
|
if (frames != 0)
|
||||||
render();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user