Posted 27 November 2014 - 10:24 PM
I'm working on an OS and I have a piece of code that parses input from the user and I can't figure out how to tell the difference between a left- and right-click. This is my code so far:
Any help would be appreciated. Thank you.
while true do
local event, button, X, Y = os.pullEventRaw()
if slc == 0 then
if event == "mouse_click" then
if X >= 2 and X <= 4 and Y == 1 and button == 1 then
term.clear ()
elseif X >= 5 and X <= 8 and Y >= 17 and Y <= 19 and button == 1 then
shell.run ("/Falchion/Prg/quest.FEF")
elseif X >= 10 and X <= 14 and Y >= 17 and Y <= 19 and button == 1 then
shell.run ("/Falchion/Prg/Sketch.FEF")
elseif X >= 15 and X <= 19 and Y >= 17 and Y <= 19 and button == 1 then
shell.run ("/Falchion/Prg/ink.FEF")
elseif X >= 20 and X <= 24 and Y >= 17 and Y <= 19 and button == 1 then
shell.run ("/Falchion/Prg/table.FEF")
elseif X == 50 and Y == 1 and button == 1 then
prompt (shutdown)
elseif X == 50 and Y == 1 and button == 2 then -- I took a guess, but that didn't work.
prompt (powMenu)
else drawGUI ()
end
end
end
end
Any help would be appreciated. Thank you.