restructuring and disabling some buttons if the computer is not advanced
This commit is contained in:
parent
1eba06c562
commit
94d6224e0a
|
@ -56,29 +56,21 @@ function playDisc()
|
||||||
term.clear()
|
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
|
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)
|
disk.playAudio(drive)
|
||||||
renderStopButton()
|
buttonRender(true)
|
||||||
renderEjectButton()
|
|
||||||
renderCloseButton()
|
|
||||||
playing = true
|
playing = true
|
||||||
status = disk.getAudioTitle(drive)
|
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
|
status = invalidFormatStatus
|
||||||
renderPlayButton()
|
buttonRender(false)
|
||||||
renderEjectButton()
|
|
||||||
renderCloseButton()
|
|
||||||
else -- If none of these checks are passed then it just means there's no disc in the drive.
|
else -- If none of these checks are passed then it just means there's no disc in the drive.
|
||||||
status = noDiscStatus
|
status = noDiscStatus
|
||||||
renderPlayButton()
|
buttonRender(false)
|
||||||
renderEjectButton()
|
|
||||||
renderCloseButton()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ejectDisc() -- Ejects the disc! How cool is that?
|
function ejectDisc() -- Ejects the disc! How cool is that?
|
||||||
term.clear()
|
term.clear()
|
||||||
renderPlayButton()
|
buttonRender(false)
|
||||||
renderEjectButton()
|
|
||||||
renderCloseButton()
|
|
||||||
if playing == true then
|
if playing == true then
|
||||||
stopDisc()
|
stopDisc()
|
||||||
disk.eject()
|
disk.eject()
|
||||||
|
@ -94,9 +86,7 @@ function stopDisc() -- Stops the music
|
||||||
status = defaultStatus
|
status = defaultStatus
|
||||||
disk.stopAudio(drive)
|
disk.stopAudio(drive)
|
||||||
term.clear()
|
term.clear()
|
||||||
renderPlayButton()
|
buttonRender(false)
|
||||||
renderEjectButton()
|
|
||||||
renderCloseButton()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function renderPlayButton() -- Renders the Play button
|
function renderPlayButton() -- Renders the Play button
|
||||||
|
@ -119,6 +109,25 @@ function renderEjectButton() -- Renders the Eject button
|
||||||
term.write(ejectText)
|
term.write(ejectText)
|
||||||
end
|
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
|
function statusRender(s) -- Renders the status bar
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
term.setTextColor(textColor)
|
term.setTextColor(textColor)
|
||||||
|
@ -126,13 +135,6 @@ function statusRender(s) -- Renders the status bar
|
||||||
term.write(s)
|
term.write(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
function renderCloseButton() -- Renders the X button
|
|
||||||
term.setCursorPos(width, 1)
|
|
||||||
term.setTextColor(textColor)
|
|
||||||
term.setBackgroundColor(backgroundColor)
|
|
||||||
term.write("x")
|
|
||||||
end
|
|
||||||
|
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setBackgroundColor(backgroundColor) -- Setting the background color
|
term.setBackgroundColor(backgroundColor) -- Setting the background color
|
||||||
renderPlayButton() -- Rendering the play button
|
renderPlayButton() -- Rendering the play button
|
||||||
|
|
Loading…
Reference in a new issue