diff --git a/townengine/main.c b/townengine/main.c index 82eb017..638f7ea 100644 --- a/townengine/main.c +++ b/townengine/main.c @@ -144,8 +144,11 @@ static void main_loop(void) { } /* finally, let's get to work */ + int frames = 0; while (ctx.frame_accumulator >= ctx.desired_frametime * ctx.update_multiplicity) { + frames += 1; for (size_t i = 0; i < ctx.update_multiplicity; ++i) { + /* TODO: disable rendering pushes on not-last ? */ render_queue_clear(); poll_events(); @@ -163,9 +166,11 @@ static void main_loop(void) { ctx.frame_accumulator -= ctx.desired_frametime; ctx.tick_count = (ctx.tick_count % ULLONG_MAX) + 1; - render(); } } + + if (frames != 0) + render(); }