From 62891da708c6570076fd63a849206d5b0643670c Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 17 Oct 2023 16:26:53 +0300 Subject: [PATCH] Finally playing some stuff? --- tape-playlist.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tape-playlist.lua b/tape-playlist.lua index 65393f4..802e0d0 100644 --- a/tape-playlist.lua +++ b/tape-playlist.lua @@ -31,6 +31,7 @@ function() while running do for i = 1, math.min(screen_h, 48) do term.setCursorPos(1, i) + term.clearLine() local song = table_of_contents[i] if song then term.write(string.format("#%2d %9s %s", i, bytes2time(song.length), song.title)) @@ -46,6 +47,11 @@ function() if ev == "mouse_click" then local x, y = table.unpack(evd, 1) + if drive.isReady() and y <= #table_of_contents then + drive.seek(-drive.getSize()) + drive.seek(table_of_contents[i].offset) + drive.play() + end elseif ev == "term_resize" then screen_w, screen_h = term.getSize() elseif ev == "tape_present" then