added buttons for switch disk and eject/insert

This commit is contained in:
StevenPhang22 2022-11-28 21:26:24 -05:00
parent 5da751ac07
commit 5b0c9a0a56
1 changed files with 14 additions and 2 deletions

View File

@ -2,6 +2,8 @@
local cart = {x1=50, y1=50, x2=100, y2=100}
local console = {x1=150, y1=50, x2=200, y2=100}
local unloadButton = {x1 = 220, y1 = 220, x2 = 250, y2 = 230}
local ejectInsertButton = {x1 = 5, y1 = 220, x2 = 64, y2 = 230}
local switchButton = {x1 = 180, y1 = 220, x2 = 210, y2 = 230}
local isDrag = false
--local gd = require("gd")
@ -37,13 +39,23 @@ while(true) do
gui.rect(unloadButton.x1, unloadButton.y1, unloadButton.x2, unloadButton.y2, "blue", "white")
gui.text(unloadButton.x1+2, unloadButton.y1+2, "Unload")
gui.rect(switchButton.x1, switchButton.y1, switchButton.x2, switchButton.y2, "blue", "white")
gui.text(switchButton.x1+2, switchButton.y1+2, "Switch")
gui.rect(ejectInsertButton.x1, ejectInsertButton.y1, ejectInsertButton.x2, ejectInsertButton.y2, "blue", "white")
gui.text(ejectInsertButton.x1+2, ejectInsertButton.y1+2, "Eject/Insert")
if ((inpt.xmouse > unloadButton.x1) and (inpt.xmouse < unloadButton.x2) and (inpt.ymouse > unloadButton.y1) and (inpt.ymouse < unloadButton.y2) and inpt.leftclick) then
emu.closeRom()
emugator.yieldwithflag()
elseif ((inpt.xmouse > switchButton.x1) and (inpt.xmouse < switchButton.x2) and (inpt.ymouse > switchButton.y1) and (inpt.ymouse < switchButton.y2) and inpt.leftclick) then
emu.switchDisk()
emu.frameadvance()
elseif ((inpt.xmouse > ejectInsertButton.x1) and (inpt.xmouse < ejectInsertButton.x2) and (inpt.ymouse > ejectInsertButton.y1) and (inpt.ymouse < ejectInsertButton.y2) and inpt.leftclick) then
emu.insertOrEjectDisk()
emu.frameadvance()
else
emu.frameadvance()
end
end
--emu.frameadvance()
end