I still Need HELP TO FINALIZE MY PAINT PROGRAM. by May 4th 2012. PLEASE HELP!!!
in
Programming Questions
•
1 year ago
I need help to finish my paint program. I want to relocate the rectangles and circles on the right side of the GUI screen on the Y axis in two rows one for rectangles and one for circles. The only problem is is that when I did just that the paint program could not paint the colours of the shapes it could only paint black.
This is what I have so far.
int Yellow;
int Red;
int Green;
int Blue;
int black;
int LightGrey;
color currentColor;
boolean typeIsRect;
int Red;
int Green;
int Blue;
int black;
int LightGrey;
color currentColor;
boolean typeIsRect;
void setup()
{
size(640,480);
background(0);
frameRate(59);
Yellow = color(255,255,0);
Red = color(255,0,0);
Green = color(0,255,0);
Blue = color(0,0,255);
black = color(0);
LightGrey = color(200);
currentColor = color(102);
typeIsRect = true;
PFont font;
textAlign(CENTER);
fill(95, 245, 183);
text("Paint Pro 3000", 300, 60);
}
Red = color(255,0,0);
Green = color(0,255,0);
Blue = color(0,0,255);
black = color(0);
LightGrey = color(200);
currentColor = color(102);
typeIsRect = true;
PFont font;
textAlign(CENTER);
fill(95, 245, 183);
text("Paint Pro 3000", 300, 60);
}
void draw()
{
stroke(5);
smooth();
fill(LightGrey);
rect(10,10,190,70);
rect(10,10,190,70);
fill(Yellow);
rect(20,20,20,20);
fill(Red);
rect(50,20,20,20);
fill(Green);
rect(80,20,20,20);
fill(Blue);
rect(110,20,20,20);
fill(black);
rect(140,20,50,50);
fill(Yellow);
ellipse(30,60,20,20);
fill(Red);
ellipse(60,60,20,20);
fill(Green);
ellipse(90,60,20,20);
fill(Blue);
ellipse(120,60,20,20);
rect(20,20,20,20);
fill(Red);
rect(50,20,20,20);
fill(Green);
rect(80,20,20,20);
fill(Blue);
rect(110,20,20,20);
fill(black);
rect(140,20,50,50);
fill(Yellow);
ellipse(30,60,20,20);
fill(Red);
ellipse(60,60,20,20);
fill(Green);
ellipse(90,60,20,20);
fill(Blue);
ellipse(120,60,20,20);
if (mousePressed)
{
noStroke();
fill(currentColor);
if (typeIsRect)
{
if ((mouseX>140) && (mouseY>20) && (mouseX<190) && (mouseY<70))
{
rect(mouseX-25,mouseY-25,50,50);
}
else
{
rect(mouseX-10,mouseY-10,20,20);
}
}
else
{
ellipse(mouseX,mouseY,20,20);
}
}
}
void mousePressed()
{
{
if ((mouseX>20) && (mouseY>20) && (mouseX<40) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Yellow);
}
if ((mouseX>50) && (mouseY>20) && (mouseX<70) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Red);
}
if ((mouseX>80) && (mouseY>20) && (mouseX<100) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Green);
}
if ((mouseX>110) && (mouseY>20) && (mouseX<130) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Blue);
}
if ((mouseX>140) && (mouseY>20) && (mouseX<190) && (mouseY<70))
{
typeIsRect = true;
currentColor = color(black);
}
{
typeIsRect = true;
currentColor = color(Yellow);
}
if ((mouseX>50) && (mouseY>20) && (mouseX<70) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Red);
}
if ((mouseX>80) && (mouseY>20) && (mouseX<100) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Green);
}
if ((mouseX>110) && (mouseY>20) && (mouseX<130) && (mouseY<40))
{
typeIsRect = true;
currentColor = color(Blue);
}
if ((mouseX>140) && (mouseY>20) && (mouseX<190) && (mouseY<70))
{
typeIsRect = true;
currentColor = color(black);
}
if ((mouseX>20) && (mouseY>50) && (mouseX<40) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Yellow);
}
if ((mouseX>50) && (mouseY>50) && (mouseX<70) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Red);
}
if ((mouseX>80) && (mouseY>50) && (mouseX<100) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Green);
}
if ((mouseX>110) && (mouseY>50) && (mouseX<130) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Blue);
}
}
{
typeIsRect = false;
currentColor = color(Yellow);
}
if ((mouseX>50) && (mouseY>50) && (mouseX<70) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Red);
}
if ((mouseX>80) && (mouseY>50) && (mouseX<100) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Green);
}
if ((mouseX>110) && (mouseY>50) && (mouseX<130) && (mouseY<70))
{
typeIsRect = false;
currentColor = color(Blue);
}
}
1