From a06361ad4a9cc093403efbecf420aae2cb549bfd Mon Sep 17 00:00:00 2001 From: hkc Date: Mon, 16 Sep 2024 16:32:38 +0300 Subject: [PATCH] Off-by-one. Again. --- video.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video.lua b/video.lua index d440913..3a28adc 100644 --- a/video.lua +++ b/video.lua @@ -190,7 +190,7 @@ table.insert(subthreads, function() draw_bar(ty - 3, colors.blue, colors.gray, #frames / n_frames, "Loading video [%5d / %5d]", #frames, n_frames) draw_bar(ty - 2, colors.red, colors.gray, #audio_frames.l / n_audio_samples, "Loading audio [%5d / %5d]", #audio_frames.l, n_audio_samples) os.sleep(0.25) - until #frames >= n_frames or #audio_frames.l >= n_audio_samples + until #frames >= n_frames and #audio_frames.l >= n_audio_samples print() end) @@ -263,8 +263,8 @@ table.insert(subthreads, function() term.write(string.format("Playing frame: %d/%d", frame + 1, #frames)) local img = frames[frame + 1] if img ~= nil then - local x = math.max(math.floor((mon_w - img.w) / 2), 0) - local y = math.max(math.floor((mon_h - img.h) / 2), 0) + local x = math.max(math.floor((mon_w - img.w) / 2), 1) + local y = math.max(math.floor((mon_h - img.h) / 2), 1) ccpi.draw(img, x, y, monitor) end os.sleep(delay)