Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - Assignment Instructions_6.docx Assignment Instructions All code must be done in the processing software. Free software download on processing.org Will need 4 global variables : 1....

1 answer below »
Microsoft Word - Assignment Instructions_6.docx
Assignment Instructions

All code must be done in the processing software. Free software download on
processing.org

Will need 4 global variables :
1. startX
to store the x coordinate of the starting position of cu
ent shape being drawn
2. startY
to store the y coordinate of the starting position of cu
ent shape being
drawn
3. cu
entColor
to store color of the cu
ent shape of cu
ent shape being drawn
4. cu
entShape
to store user's choice of cu
ent shape being drawn
Will need 6 parallel a
ays that need to be declared globally - each one to capture the aspect
of the shape that is being drawn ( feel free to use short forms like fcX or x1).
1. firstcornerX
to store x coordinate of the first corner of a shape
2. firstCornerY
to store y coordinate of the first corner of a shape
3. secondCornerX
to store x coordinate of the second corner of a shape
4. secondCornerY
to store y coordinate of the second corner of a shape
5. colors
color of a shape
6. shapes
to capture the type of a shape
In mousePressed :
1. save cu
ent mouse locations into appropriate variables startX, startY.
2. generate a random color and store it in the variable cu
entColor.
3. save user's choice of shape inside the variable called cu
entShape depending on the
mouseButton. i.e. if user pressed LEFT mouse button then you would store 1 for
ectangle and 2 for ellipse.
In mouseReleased: (user has finished determining the size of the object - so time for us to store
the info into a
ays):
store the info regarding cu
ently drawn shape into appropriate a
ays.
In mouseDragged :
1. clear the canvas (that helps us to remove the drag lines).
2. draw all existing shapes by using info stored in the parallel a
ays (use a for-loop).
Do the following inside the for-loop :
a. fill with i-th elemtent's color taken from a
ay colors
. determine i-th element's shape taken from the a
ay shapes and write code to
make the appropriate shape .
3. Now that you have drawn all the existing shapes, it is time to reflect the user's actions.
a. fill with the cu
entColor
. determine which shape needs to be drawn and accordingly call the rect or ellipse
(this is info is available in the variable cu
entShape and it's value should have
een determined in step 3 of mousePressed ).

Lavf XXXXXXXXXX
Answered Same Day Oct 06, 2021

Solution

Ramachandran answered on Oct 06 2021
130 Votes
Order-92983/output.JPG
Order-92983/sketch/sketch.pde
int startX;
int startY;
color cu
entColor;
int cu
entShape;
1 for rectangle 2 for ellipse
int MAX_SHAPES = 100;
int[] firstCornerX = new int[MAX_SHAPES];
int[] firstCornerY = new int[MAX_SHAPES];
int[] secondCornerX = new int[MAX_SHAPES];
int[] secondCornerY = new int[MAX_SHAPES];
color[] colors = new color[MAX_SHAPES];
int[] shapes = new int[MAX_SHAPES];
int shapeCount = 0;
void setup() {
size(750, 750);
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here