int click = 0; int x_1 = 0; int x_2 = 0; int y_1 = 0; int y_2 = 0; void setup() { size(500,500); }
void draw() {
}
void mouseClicked() { if (click == 0){ x_1 = mouseX; y_1 = mouseY; } if (click == 1){ x_2 = mouseX; y_2 = mouseY; } click = click + 1; if (click == 2){ line(x_1,y_1,x_2,y_2); click = 0; } }