创建一个窗口并在窗口上绘制基本的形状:
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(){
int R = int(random(255));
int G = int(random(255));
int B = int(random(255));
stroke(R, G, B);
if(mousePressed){
fill(192, 64, 0);
quad(2*width/3 + 50, height/10, width-20, height/9+10, width-20, 3*height/9, 2*width/3&#