mouseX, translate and mousePressed()
in
Programming Questions
•
9 months ago
Hi,
I've been looking for this in other posts. There are similar issues reported, but the answers I've found do not completely apply to my case (surprisingly, because I think it's kind of basic stuff).
In short, I don't know how to have variables mouseX and mouseY changed according to a transform function within mousePresses (say, translate()). Here's what I would like to achieve:
- void mousePressed()
- {
- pushMatrix();
- translate(width/2,height/2); // want to have coordinates respect to the center of the sketch
- println(mouseX + "," + mouseY); // this should return 0,0 when I click on the center of the sketch
- popMatrix();
- }
What am I missing?
thank you in advance
1