mirror of
https://fem.mint.lgbt/m/Rhythmblock.git
synced 2024-08-14 20:27:11 +00:00
restructuring and disabling some buttons if the computer is not advanced
This commit is contained in:
parent
1eba06c562
commit
94d6224e0a
1 changed files with 25 additions and 23 deletions
|
@ -56,29 +56,21 @@ function playDisc()
|
|||
term.clear()
|
||||
if disk.isPresent(drive) and disk.hasAudio(drive) then -- Determines if there's a disc or not and if it's a music disc
|
||||
disk.playAudio(drive)
|
||||
renderStopButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
buttonRender(true)
|
||||
playing = true
|
||||
status = disk.getAudioTitle(drive)
|
||||
elseif disk.isPresent(drive) then -- If there's a floppy disk for example, Rhythmbox won't play it.
|
||||
buttonRender(true)
|
||||
status = invalidFormatStatus
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
buttonRender(false)
|
||||
else -- If none of these checks are passed then it just means there's no disc in the drive.
|
||||
status = noDiscStatus
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
buttonRender(false)
|
||||
end
|
||||
end
|
||||
|
||||
function ejectDisc() -- Ejects the disc! How cool is that?
|
||||
term.clear()
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
buttonRender(false)
|
||||
if playing == true then
|
||||
stopDisc()
|
||||
disk.eject()
|
||||
|
@ -94,9 +86,7 @@ function stopDisc() -- Stops the music
|
|||
status = defaultStatus
|
||||
disk.stopAudio(drive)
|
||||
term.clear()
|
||||
renderPlayButton()
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
buttonRender(false)
|
||||
end
|
||||
|
||||
function renderPlayButton() -- Renders the Play button
|
||||
|
@ -119,6 +109,25 @@ function renderEjectButton() -- Renders the Eject button
|
|||
term.write(ejectText)
|
||||
end
|
||||
|
||||
function renderCloseButton() -- Renders the Close button
|
||||
term.setCursorPos(width, 1)
|
||||
term.setTextColor(textColor)
|
||||
term.setBackgroundColor(backgroundColor)
|
||||
term.write("x")
|
||||
end
|
||||
|
||||
function buttonRender(play) -- Render some buttons depending if the computer is advanced or not
|
||||
if play == true then
|
||||
renderStopButton()
|
||||
else
|
||||
renderPlayButton()
|
||||
end
|
||||
if term.isColour() then
|
||||
renderEjectButton()
|
||||
renderCloseButton()
|
||||
end
|
||||
end
|
||||
|
||||
function statusRender(s) -- Renders the status bar
|
||||
term.setCursorPos(1, 1)
|
||||
term.setTextColor(textColor)
|
||||
|
@ -126,13 +135,6 @@ function statusRender(s) -- Renders the status bar
|
|||
term.write(s)
|
||||
end
|
||||
|
||||
function renderCloseButton() -- Renders the X button
|
||||
term.setCursorPos(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
|
||||
|
|
Loading…
Reference in a new issue