创建一个窗口并在窗口上绘制基本的形状:
class DrawShape{
DrawShape(){
}
void draw_line(){
int R = int(random(255));
int G = int(random(255));
int B = int(random(255));
stroke(R, G, B, 255);
if(mousePressed){
line(10, height/5, width/3-10, height/5);
}
}
void draw_triangle(){
int R = int(random(255));
int G = int(random(255));
int B = int(random(255));
stroke(R, G, B, 255);
if(mousePressed){
noFill();
triangle(width/2, height/8, width/1.5-10, height/3, width/3 + 10, height/4 + 10);
}
}
void draw_quadrangle(){
&