Trying to make a button, but help needed!

Hello world! So, I'm new to processing and so I've been trying to make a button as part of a college assignment thing, but it won't work for some reason. Here's the relevant code for you guys to see if I did anything stupidly wrong. It works, but the button doesn't do anything:

void mouseClicked()

{

if (mouseX>218 && mouseX<218+buttonWidth && mouseY>350 && mouseY<buttonHeight)

{

fill(190,200,0);

rect(218,350,buttonWidth,buttonHeight);

}

}

(Also, I did declare buttonWidth and buttonHeight before in the code. This is only a segment of it).

If any of you can help me, I'd appreciate it!

Tagged:

Answers

Sign In or Register to comment.