Im trying to make a paint application. when i click on the shape icons the shape of the brush dosent change. when i click on the save icons they dont work either. im not sure what im missing in my code to get them to work.
boolean glide;
int white;
int red;
int green;
int blue;
int yellow;
int purple;
int brown;
int grey;
int black;
int current;
PImage img;
PImage img1;
PImage png;
void setup()
{
background(255);
size(1500,700);
white=color(255);
red=color(255,0,0);
green=color(0,255,0);
blue=color(0,0,255);
yellow=color(255,255,0);
purple=color(255,0,255);
brown=color(139,42,42);
grey=color(139,139,139);
black=color(0);
current=color(255);
glide=true;
img = loadImage("eraser.png");
img1 = loadImage("jpg.JPG");
png = loadImage("png.JPG");
}
void draw()
{
stroke(10);
smooth();
rectMode(CORNER);
fill(109);
rect(0,0,500,700);
strokeWeight(5);
fill(255);
rect(50,50,100,50);
line(60,60,140, 90);
fill(255);
rect(200,50,100,50);
rect(210,60,80,30 );
fill(255);
rect(350,50,100,50);
ellipse(400,75,50,30 );
fill(255);
rect(50,150,100,50);
image(img,60,160,80,30);
fill(255);
rect(200,150,100,50);
image(img1,200,150,100,50);
fill(255);
rect(350,150,100,50);
image(png,350,150,100,50);
fill(white);
rect(50,250,100,50);
fill(red);
rect(200,250,100,50);
fill(green);
rect(350,250,100,50);
fill(blue);
rect(50,350,100,50);
fill(yellow);
rect(200,350,100,50);
fill(purple);
rect(350,350,100,50);
fill(brown);
rect(50,450,100,50);
fill(grey);
rect(200,450,100,50);
fill(black);
rect(350,450,100,50);
if (mousePressed)
{
noStroke();
fill(current);
if (glide)
{if((mouseX>50)&&(mouseY>50) && (mouseX<150)&&(mouseY<100))
{ glide=true;
line(mouseX-15,mouseY-15,mouseX,mouseY);}
else if((mouseX>200)&&(mouseY>50) && (mouseX<300)&&(mouseY<100))
{ glide=true;
rect(mouseX-25,mouseY-25,50,50);
}
else if((mouseX>350)&&(mouseY>50) && (mouseX<450)&&(mouseY<100))
{ glide=true;
ellipse(mouseX,mouseY,50,50);
}
else if(mousePressed==true&&(mouseX>200)&&(mouseY>150) && (mouseX<300)&&(mouseY<200))
{ glide=true;
saveFrame("save-###.jpg");}
else if(mousePressed==true&&(mouseX>350)&&(mouseY>150) && (mouseX<450)&&(mouseY<200))
{ glide=true;
saveFrame("save-###.png");}
}
}
}
void mousePressed()
{
if((mouseX>50)&&(mouseY>150) && (mouseX<150)&&(mouseY<200))
{ glide=true;
current=color(white);
rect(mouseX-50,mouseY-50,50,50);}
if((mouseX>50)&&(mouseY>250) && (mouseX<150)&&(mouseY<300))
{ glide=true;
current=color(white);}
if((mouseX>200)&&(mouseY>250) && (mouseX<300)&&(mouseY<300))
{ glide=true;
current=color(red);}
if((mouseX>350)&&(mouseY>250) && (mouseX<450)&&(mouseY<300))
{ glide=true;
current=color(green);}
if((mouseX>50)&&(mouseY>350) && (mouseX<150)&&(mouseY<400))
{ glide=true;
current=color(blue);}
if((mouseX>200)&&(mouseY>350) && (mouseX<300)&&(mouseY<400))
{ glide=true;
current=color(yellow);}
if((mouseX>350)&&(mouseY>350) && (mouseX<450)&&(mouseY<400))
{ glide=true;
current=color(purple);}
if((mouseX>50)&&(mouseY>450) && (mouseX<150)&&(mouseY<500))
{ glide=true;
current=color(brown);}
if((mouseX>200)&&(mouseY>450) && (mouseX<300)&&(mouseY<500))
{ glide=true;
current=color(grey);}
if((mouseX>350)&&(mouseY>450) && (mouseX<450)&&(mouseY<500))
{ glide=true;
current=color(black);}
}