mirror of
https://fem.mint.lgbt/m/Rhythmblock.git
synced 2024-08-14 20:27:11 +00:00
added close button for mouse and monitor usage
This commit is contained in:
parent
e1791d8e9c
commit
0ea45bfc0b
1 changed files with 20 additions and 3 deletions
|
@ -45,22 +45,27 @@ function playDisc()
|
|||
disk.playAudio(drive)
|
||||
renderStopButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
playing = true
|
||||
status = disk.getAudioTitle(drive)
|
||||
elseif disk.isPresent(drive) then -- If there's a floppy disk for example, Rhythmbox won't play it.
|
||||
status = invalidFormatStatus
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
else -- If none of these checks are passed then it just means there's no disc in the drive.
|
||||
status = noDiscStatus
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
end
|
||||
end
|
||||
|
||||
function ejectDisc() -- Ejects the disc! How cool is that?
|
||||
term.clear()
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
if playing == true then
|
||||
stopDisc()
|
||||
disk.eject()
|
||||
|
@ -78,6 +83,7 @@ function stopDisc() -- Stops the music
|
|||
term.clear()
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
end
|
||||
|
||||
function renderPlayButton() -- Renders the Play button
|
||||
|
@ -100,17 +106,25 @@ function renderEjectButton() -- Renders the Eject button
|
|||
term.write(ejectText)
|
||||
end
|
||||
|
||||
function statusRender(s) -- Resets the status position
|
||||
function statusRender(s) -- Renders the status bar
|
||||
term.setCursorPos(1, 1)
|
||||
term.setTextColor(textColor)
|
||||
term.setBackgroundColor(backgroundColor)
|
||||
term.write(s)
|
||||
end
|
||||
|
||||
function renderCloseButton() -- Renders the X button
|
||||
term.setCurorPos(width, 1)
|
||||
term.setTextColor(textColor)
|
||||
term.setBackgroundColor(backgroundColor)
|
||||
term.write("x")
|
||||
end
|
||||
|
||||
term.clear()
|
||||
term.setBackgroundColor(backgroundColor) -- Setting the background color
|
||||
renderPlayButton() -- Rendering the play button
|
||||
renderEjectButton() -- Rendering the eject button
|
||||
renderCloseButton() -- Rendering the close button
|
||||
status = defaultStatus -- Setting the value to the default
|
||||
|
||||
while true do
|
||||
|
@ -126,8 +140,11 @@ while true do
|
|||
playDisc()
|
||||
end
|
||||
elseif eventData[2] == 1 and eventData[3] >= centerWidth - 2 and eventData[4] >= centerHeight + 4 and eventData[3] <= centerWidth + 2 and eventData[4] <= centerHeight + 4 then
|
||||
term.clear()
|
||||
ejectDisc()
|
||||
elseif eventData[2] == 1 and eventData[3] == width and eventData[4] == 1 then
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
return true
|
||||
end
|
||||
elseif event == "key_up" then
|
||||
local name = keys.getName(eventData[2]) or "unknown key"
|
||||
|
|
Loading…
Reference in a new issue