From 56679110e303e78ed20e0466460121177cbea34c Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 18 Jun 2023 18:02:22 +0200 Subject: [PATCH] added frame limiting --- src/engine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine.c b/src/engine.c index 3c146a2..6e460dd 100644 --- a/src/engine.c +++ b/src/engine.c @@ -86,6 +86,11 @@ int _engine_run() { update_objects(); // update world objects draw_objects(); // draw world objects swap_buffer(); + + while(_delta_time < _min_frame_interval) { + timespec_get(&next_time, TIME_UTC); + _delta_time = timespec_to_sec(next_time) - timespec_to_sec(start_last_frame); + } } return 0; }