mirror of
https://fem.mint.lgbt/m/Rhythmblock.git
synced 2024-08-14 20:27:11 +00:00
bug fixing
This commit is contained in:
parent
f27e917202
commit
2d84a142e6
1 changed files with 6 additions and 5 deletions
|
@ -56,7 +56,7 @@ function ejectDisc() -- Ejects the disc! How cool is that?
|
||||||
stopDisc()
|
stopDisc()
|
||||||
disk.eject()
|
disk.eject()
|
||||||
elseif disk.isPresent(drive) then -- If there's a disc, it'll be ejected.
|
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.
|
else -- If not it'll report there's no disc.
|
||||||
status = noDiscStatus
|
status = noDiscStatus
|
||||||
end
|
end
|
||||||
|
@ -87,12 +87,12 @@ function renderEjectButton() -- Renders the Eject button
|
||||||
term.setTextColor(buttonColor)
|
term.setTextColor(buttonColor)
|
||||||
term.setCursorPos(centerWidth - 2, centerHeight + 4)
|
term.setCursorPos(centerWidth - 2, centerHeight + 4)
|
||||||
term.write(ejectText)
|
term.write(ejectText)
|
||||||
statusPos()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function statusPos() -- Resets the status position
|
function statusRender(s) -- Resets the status position
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
term.setTextColor(textColor)
|
term.setTextColor(textColor)
|
||||||
|
term.write(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
term.clear()
|
term.clear()
|
||||||
|
@ -102,6 +102,7 @@ renderEjectButton() -- Rendering the eject button
|
||||||
status = defaultStatus -- Setting the value to the default
|
status = defaultStatus -- Setting the value to the default
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
|
statusRender(status)
|
||||||
local eventData = {os.pullEvent()}
|
local eventData = {os.pullEvent()}
|
||||||
local event = eventData[1]
|
local event = eventData[1]
|
||||||
|
|
||||||
|
@ -116,13 +117,13 @@ while true do
|
||||||
ejectDisc()
|
ejectDisc()
|
||||||
end
|
end
|
||||||
elseif event == "monitor_touch" then
|
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
|
if playing == true then
|
||||||
stopDisc()
|
stopDisc()
|
||||||
else
|
else
|
||||||
playDisc()
|
playDisc()
|
||||||
end
|
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()
|
ejectDisc()
|
||||||
end
|
end
|
||||||
elseif event == "key_up" then
|
elseif event == "key_up" then
|
||||||
|
|
Loading…
Reference in a new issue