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.
How? @dave1707
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()
How do I do that? @dave1707
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
Thank you @dave1707 sorry for being. A neusence
I can’t open your docs (permission closed)