We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How come the program does not complete the shape when the user hits 'Enter'?
Here is the code:
boolean firstPoint;
void setup(){
size(500,500,P2D);
firstPoint = true;
}
//for some reason point will not work without draw
void draw(){
}
void keyPressed(){
if(key == ENTER){
endShape(CLOSE);
firstPoint = true;
}
}
void mousePressed(){
if(firstPoint){
beginShape();
firstPoint = false;
}
vertex(mouseX,mouseY);
point(mouseX,mouseY);
}
Answers
Maybe createShape() might work: https://processing.org/reference/createShape_.html
Thank you. That solved the problem.