How to make a button ?
in
Programming Questions
•
5 months ago
I want to make a button that when i click on it, something else will appear, in a new "page" and we will no longer se tha previous button on the screen...
But I only manage to do a code, where it appears the button that I must click, but when i do, the "new page" only appears whlie i press the mouse. When I released it, it only shows the button... And i want the button to be an image that i create and not something created with the Processing, like an Ellipse..
Im new at this, I would aprecciate some help because i need to deliever a work that depends on this..
This is what i made so far:
But I only manage to do a code, where it appears the button that I must click, but when i do, the "new page" only appears whlie i press the mouse. When I released it, it only shows the button... And i want the button to be an image that i create and not something created with the Processing, like an Ellipse..
Im new at this, I would aprecciate some help because i need to deliever a work that depends on this..
This is what i made so far:
float x = 334;
float y = 334;
void setup(){
size(500,500);
background(255);
}
void draw(){
background(255);
PImage button;
button=loadImage("button.gif");
image(button,0,0);
if(mousePressed){
if(mouseX<=x && mouseY<=y){
PImage img;
img=loadImage("img.png");
image(img,0,0);
}
}
}
Thank you.
1