changed status stuff to variables and beginning to work on GUI

This commit is contained in:
Lux Aliaga 2021-05-06 13:34:43 -04:00
parent 80b58e4648
commit d85c57d3ea

View file

@ -19,12 +19,17 @@ else
end end
end end
if driveCount > 1 then if driveCount > 1 then
print("Too many disk drives. Specify where the disk drive is with the argument -d") print("Too many disk drives. Specify where the disk drive is by running Rhythmblock with the argument")
os.exit() os.exit()
end end
end end
status = "" defaultStatus = "Rhythmblock 0.0.1a"
invalidFormatStatus = "Not a music disc"
noDiscStatus = "No disc"
notPlayingStatus ="No disc playing"
noDiscInDriveStatus = "No disc in drive"
status = defaultStatus
function playDisc() function playDisc()
@ -33,26 +38,31 @@ function playDisc()
status = disk.getAudioTitle(drive) status = disk.getAudioTitle(drive)
playing = true playing = true
elseif disk.isPresent(drive) then elseif disk.isPresent(drive) then
print "Not a music disc" status = "Not a music disc"
else else
print "No disc" print("No disc")
end end
end end
function ejectDisc() function ejectDisc()
disk.eject() disk.eject()
end end
function stopDisc() function stopDisc()
if playing == true then if playing == true then
disk.stopAudio() disk.stopAudio()
status = "Rhythmblock 0.0.1a" playing = 0
status = defaultStatus
else else
status = "No disc is playing" status = "No disc is playing"
end end
end end
function renderPlayButton() function renderPlayButton()
paintutils.drawFilledBox(centerWidth - 5, centerHeight - 5, centerWidth + 5, centerHeight + 5 accentColor) paintutils.drawFilledBox(centerWidth - 3, centerHeight - 4, centerWidth + 2, centerHeight + 2, accentColor)
paintutils.drawLine(centerWidth - 2, centerHeight - 3, centerWidth - 2, centerHeight + 1, buttonColor)
paintutils.drawLine(centerWidth - 1, centerHeight - 2, centerWidth - 1, centerHeight, buttonColor)
paintutils.drawPixel(centerWidth + 1, centerHeight)
end end
renderPlayButton()