forked from hkc/cc-stuff
1
0
Fork 0

Off-by-one. Again.

This commit is contained in:
Casey 2024-09-16 16:32:38 +03:00
parent c4740b8bfd
commit a06361ad4a
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 3 additions and 3 deletions

View File

@ -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 - 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) 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) 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() print()
end) end)
@ -263,8 +263,8 @@ table.insert(subthreads, function()
term.write(string.format("Playing frame: %d/%d", frame + 1, #frames)) term.write(string.format("Playing frame: %d/%d", frame + 1, #frames))
local img = frames[frame + 1] local img = frames[frame + 1]
if img ~= nil then if img ~= nil then
local x = math.max(math.floor((mon_w - img.w) / 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), 0) local y = math.max(math.floor((mon_h - img.h) / 2), 1)
ccpi.draw(img, x, y, monitor) ccpi.draw(img, x, y, monitor)
end end
os.sleep(delay) os.sleep(delay)