bug fixing

This commit is contained in:
Lux Aliaga 2021-05-07 02:52:13 -04:00
parent f27e917202
commit 2d84a142e6
1 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,7 @@ function ejectDisc() -- Ejects the disc! How cool is that?
stopDisc()
disk.eject()
elseif disk.isPresent(drive) then -- If there's a disc, it'll be ejected.
disk.eject()
disk.eject(drive)
else -- If not it'll report there's no disc.
status = noDiscStatus
end
@ -87,12 +87,12 @@ function renderEjectButton() -- Renders the Eject button
term.setTextColor(buttonColor)
term.setCursorPos(centerWidth - 2, centerHeight + 4)
term.write(ejectText)
statusPos()
end
function statusPos() -- Resets the status position
function statusRender(s) -- Resets the status position
term.setCursorPos(1, 1)
term.setTextColor(textColor)
term.write(s)
end
term.clear()
@ -102,6 +102,7 @@ renderEjectButton() -- Rendering the eject button
status = defaultStatus -- Setting the value to the default
while true do
statusRender(status)
local eventData = {os.pullEvent()}
local event = eventData[1]
@ -116,13 +117,13 @@ while true do
ejectDisc()
end
elseif event == "monitor_touch" then
if eventData[4] >= centerWidth - 4 and eventData[5] >= centerHeight - 4 and eventData[4] <= centerWidth + 4 and eventData[5] <= centerHeight + 2 then
if eventData[3] >= centerWidth - 4 and eventData[4] >= centerHeight - 4 and eventData[3] <= centerWidth + 4 and eventData[4] <= centerHeight + 2 then
if playing == true then
stopDisc()
else
playDisc()
end
elseif eventData[4] >= centerWidth - 2 and eventData[5] >= centerHeight + 4 and eventData[4] <= centerWidth + 2 and eventData[5] <= centerHeight + 4 then
elseif eventData[3] >= centerWidth - 2 and eventData[4] >= centerHeight + 4 and eventData[3] <= centerWidth + 2 and eventData[4] <= centerHeight + 4 then
ejectDisc()
end
elseif event == "key_up" then