We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I tried putting void mousePressed inside of a class and it wouldn't work, but then when I moved it outside of the class it worked. How come it only worked when outside of the class?
Answers
mousePressed() is a Processing PApplet's callback function. Just like setup() & draw() are too.
If we place any of them inside another class, the PApplet class won't be able to find them!
Unless we registerMethod() them btW: :P
http://forum.Processing.org/two/discussions/tagged?Tag=registermethod()
Place mousePressed() in the global scope and have it call your class' method
Here is an example:
mousePressed is a build-in function that can obly be seen by processing when it's outside the classes. So when it's on a global level.
As been said you can call the hidden mousePressed (it can have any name) that's inside the class from the real in-build mousePressed (outside the class):
Same goes for mouseClicked etc etc