note: if your confused with that just imagine how confused i am XD
but yeah i have a mouse api/class i'm trying to make , where it can detect and return a table of info , or ( later configureable ) you can just use it like click.row to get the row , but i cant seem to get the row, col , ect to actualy work when i call them like that. so yeah , if you can let me know what i should be creating to work how i want lemme know , as well as how i should make it work like that ^^;
heres what i have
local mouseDown = {}
local mouseUp = {}
local mouseScroll = {}
event = ""
row = 0
col = 0
button = 0
direction = 0
os.loadAPI("rom/apis/parallel")
function down()
while true do
local e,b,c,r = os.pullEvent("mouse_click")
if e == "mouse_click" then
mouseDown.button = b
mouseDown.col = c
mouseDown.row = r
mouseDown.event = e
event = e
row = r
col = c
button = b
direction = 0
return mouseDown
end
end
end
function up()
while true do
local e,b,c,r = os.pullEvent("mouse_drag")
if e == "mouse_drag" then
mouseUp.button = b
mouseUp.col = c
mouseUp.row = r
mouseUp.event = e
event = e
row = r
col = c
button = b
dicrection = 0
mouseEvent = mouseUp
return mouseUp
end
end
end
function scroll()
while true do
local e,d,c,r = os.pullEvent("mouse_scroll")
if e == "mouse_scroll" then
mouseScroll.direction = direction
mouseScroll.col = col
mouseScroll.row = row
mouseScroll.event = e
event = e
direction = d
col = c
row = r
button = 0
mouseEvent = mouseScroll
return mouseScroll
end
end
end
function getLastDown()
return mouseDown
end
function getLastUp()
return mouseUp
end
function getLastScroll()
return mouseScroll
end
function listen()
parallel.waitForAny(down,up,scroll)
end