From 43c73ca298fa0da4527fb57be10e91196dee0f79 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Aug 2023 15:38:24 -0400 Subject: [PATCH] Fixed things for when a thread requests a redraw. (#1570) * Fixed things for when a thread requests a redraw. * @guldoman's changes. * Whoops. --- data/core/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 9aba4c70..16cb265e 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1429,12 +1429,17 @@ end) function core.run() local next_step + local last_frame_time while true do core.frame_start = system.get_time() local time_to_wake = run_threads() local did_redraw = false - if not next_step or system.get_time() >= next_step then - did_redraw = core.step() + local force_draw = core.redraw and last_frame_time and core.frame_start - last_frame_time > (1 / config.fps) + if force_draw or not next_step or system.get_time() >= next_step then + if core.step() then + did_redraw = true + last_frame_time = core.frame_start + end next_step = nil end if core.restart_request or core.quit_request then break end