We are about to switch to a new forum software. Until then we have removed the registration on this forum.
PFont a;
String coordinates = "(" + mouseX + "," + mouseY + ")";
void setup() {
size(500, 350);
a = createFont("Arial", 20, true);
}
void draw() {
fill(0);
textFont(a);
if (mousePressed) {
text(coordinates, mouseX, mouseY);
}
if (keyPressed) {
if (key == ' ') {
background(204);
}
}
}
Answers
because the coordinates String gets set ONCE, at the top there. you need to change it every loop if you want to see it change.
change line 13 to this: text("(" + mouseX + "," + mouseY + ")", mouseX, mouseY);