Computer programming: graphics,For each task below, place the commands inside the corresponding function — Task1(), Task2() or Task3(). Task 1 Draw a simplified “scene” in the graphics window by using multiple drawing commands. You must: Use at least

Begin with a new graphics project.

Copy the following code into the main.cpp file:

#include 
#define USE_INTERACTION_FUNCTIONS
#include “lpcgraphics.h”
using namespace std;

Color bgColor(“black”);
int counter = 0;

void Task1()
{

}

void Task2()
{

}

void Task3()
{

}

__INTERACTION_FUNCTIONS__

void setup()
{
background(bgColor);
}

void keyPressed()
{
if (keyCode == keySPACE)
{
counter++;
background(bgColor);
switch(counter)
{
case 1:
Task1();
break;
case 2:
Task2();
break;
case 3:
Task3();
break;
default:
stopGraphics();
}
}
}

__INTERACTION_FUNCTIONS_END__

int main()
{
cout << “Starting graphics.n”;
startGraphics(600, 400, “Exercise”);
waitForClose();
cout << “Window closed.n”;
}

For each task below, place the commands inside the corresponding function — Task1(), Task2() or Task3().

Task 1

Draw a simplified “scene” in the graphics window by using multiple drawing commands. You must:

Use at least 3 different kinds of shapes
Use at least 3 different colors
Label the picture with a word or phrase that describes what it is (e.g., “house”, “landscape”, “robot”, etc.)

Task 2

Using a for loop, draw a set of concentric circles. Each circle should have its center at the center of the window. The radius of each circle should be a multiple of 10, with the smallest having radius 10 and the largest having radius 300. The color is up to you. The result should look similar to this:

task2.png

 

Task 3

Using a for loop, draw a set of filled rectangles on the screen using random colors, similar to the picture below. Each rectangle needs to have a width matching the width of the window and a height of 20, and the y positions span all possible y values on the window in steps of 20.

"Looking for a Similar Assignment? Order now and Get a Discount!