I have tried to do a mouse/graphic API but I still blocked at the click detection algorithm. Here the code I use :
function buttonClick(x, y, a, B)/>/>
clic, x1, y1 = os.pullEvent("mouse_click")
for b=b, 1 do
if x1<= a-b then
for a=a, 1 do
if y1 <= b-a then
test = "true"
else
a = a-1
end
end
else
b = b-1
end
end
if test == "true" then
for y=y, 1 do
if x1 >= x-y then
for x=x, 1 do
if y1 >= y-x then
clicked = "true"
return clicked
else
x = x+1
end
end
else
y = y+1
end
end
end
When I click on the button, it doesn't detect anything.