Drawing Triangles while(!key[KEY_ESC]) while(!key[KEY_ESC]) { //set a random location //set a random location x1 = 10 + rand() % (SCREEN_W-20); x1 = 10 + rand() % (SCREEN_W-20); y1 = 10 + rand() % (SCREEN_H-20); y1 = 10 + rand() % (SCREEN_H-20); x2 = 10 + rand() % (SCREEN_W-20); x2 = 10 + rand() % (SCREEN_W-20); y2 = 10 + rand() % (SCREEN_H-20); y2 = 10 + rand() % (SCREEN_H-20); x3 = 10 + rand() % (SCREEN_W-20); x3 = 10 + rand() % (SCREEN_W-20); y3 = 10 + rand() % (SCREEN_H-20); y3 = 10 + rand() % (SCREEN_H-20); //set a random color //set a random color red = rand() % 255; red = rand() % 255; green = rand() % 255; green = rand() % 255; blue = rand() % 255; blue = rand() % 255; color = makecol(red,green,blue); color = makecol(red,green,blue); //draw the triangle //draw the triangle triangle(screen,x1,y1,x2,y2,x3,y3,color); triangle(screen,x1,y1,x2,y2,x3,y3,color); rest(100); rest(100); }
{}