I am curious of how to make a so called, exit button for my application I am working on wich you can veiw here: https://docs.google.com/document/d/11N6XFN_D8CiNue-mMGUdknCKXgxcwnAQiTGZXgCYLGs
Thank you for your time and answers.
Someone please answer.
Create a button that calls the close() function.
There are plenty examples of buttons and calling functions when they’re pressed on the forum.
Just in case you can’t find anything, here’s what to do.
1: draw a rectangle in the function draw()
2: in the function touched, check if the touch x,y values are within the boundaries of the rectangle.
3 if they are, call the function close()
function setup()
end
function draw()
background(0)
fill(255)
rect(200,400,100,50)
fill(255,0,0)
text("Close",250,425)
end
function touched(t)
if t.state==BEGAN then
if t.x>200 and t.x<300 and t.y>400 and t.y<450 then
close()
end
end
end
I can’t open your docs (permission closed)