Put a void statement into a PGraphics layer

myArc() does not belong to PGraphics. You can do:

void myEllipse(PGraphics pg, int x, int y){
   //Assuming begin draw has already been called
   pg.ellipse(x,y,5,5);
}

and you will use it like this:

    circles.beginDraw();
    circles.noStroke()
    circles.fill(col);
    myEllipse(circles,mouseX, mouseY);
    circles.endDraw();

The small issue is that in this example I am not managing begin/endDraw. It is possible but you need to have a proper design aka. very well thought.

Kf

1 Like