pressing button effect
in
Programming Questions
•
6 months ago
hello.
I want to make an effect of pressing a button when you click with the mouse, but I can not do it.
I tried changing two images when clicked but does not work....
thanks for the help
PImage img1;
PImage img2;
void setup()
{
bacground (0,0,0);
size(100,100);
img1 = loadImage("button1.jpg"); // normal button
img2 = loadImage("button2.jpg"); // presed button
image (img1,0,0);
}
void draw()
{
}
void mousePressed()
{
if(mouseX >0 && mouseX<100 && mouseY>0 && mouseY<100)
{
image (img2,0,0);
delay(200);
image (img1,0,0)
}
1