forked from hkc/cc-stuff
1
0
Fork 0

Finally playing some stuff?

This commit is contained in:
Casey 2023-10-17 16:26:53 +03:00
parent adcae533d0
commit 62891da708
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@ function()
while running do while running do
for i = 1, math.min(screen_h, 48) do for i = 1, math.min(screen_h, 48) do
term.setCursorPos(1, i) term.setCursorPos(1, i)
term.clearLine()
local song = table_of_contents[i] local song = table_of_contents[i]
if song then if song then
term.write(string.format("#%2d %9s %s", i, bytes2time(song.length), song.title)) term.write(string.format("#%2d %9s %s", i, bytes2time(song.length), song.title))
@ -46,6 +47,11 @@ function()
if ev == "mouse_click" then if ev == "mouse_click" then
local x, y = table.unpack(evd, 1) 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 elseif ev == "term_resize" then
screen_w, screen_h = term.getSize() screen_w, screen_h = term.getSize()
elseif ev == "tape_present" then elseif ev == "tape_present" then