xxxxxxxxxx
int menuOpt = 0;
int mcolor = 0;
float colorr = 255;
float colorg = 0;
float colorb = 0;
int brushs = 10;
void setup () {
size(700,450);
}
void draw () {
if(menuOpt == 0){
fill(0);
noStroke();
rect(0,0,700,450);
fill(255);
String instruct1 = "Press the m key to show more colors";
String instruct2 = "Press the 1 - 0 keys for colors 1 - 10";
String instruct3 = "Press the o key for the eraser";
String instruct4 = "Press the i key to return to this screen";
String instruct6 = "Press the r key to reset the canvas";
String instruct5 = "Press the e key to continue";
String instruct9 = "Once your are in brush size menu, press e to return to return to canvas";
textSize(30);
text(instruct1,10,10,680,50);
text(instruct2,10,40,680,50);
text(instruct3,10,70,680,50);
text(instruct4,10,100,680,50);
text(instruct5,10,410,680,50)
text(instruct6,10,130,680,50);
text(instruct9,10,190,860,100);
text("Press keys a - ; to change brush sizes",10,180);
}
else if(menuOpt == 1){
noStroke();
fill(245,244,237);
rect(0,0,700,400);
menuOpt +=1;
}
else if(menuOpt == 2){
noStroke();
fill(200);
rect(0,350,700,100);
if(mcolor == 0){
textSize(30);
String c1 = "1";
String c2 = "2";
String c3 = "3";
String c4 = "4";
String c5 = "5";
String c6 = "6";
String c7 = "7";
String c8 = "8";
String c9 = "9";
String c10 = "0";
String c11 = "o";
stroke(0);
//red
fill(255,0,0);
rect(5,355,40,40);
fill(0);
text(c1,15,355,40,40);
//green
fill(0,255,0);
rect(55,355,40,40);
fill(0);
text(c2,65,355,40,40)
//blue
fill(0,0,255);
rect(105,355,40,40);
fill(0);
text(c3,115,355,40,40);
//yellow
fill(255,255,0);
rect(155,355,40,40);
fill(0);
text(c4,165,355,40,40);
//black
stroke(255);
fill(0);
rect(205,355,40,40);
fill(255);
text(c5,215,355,40,40);
//eraser
stroke(0);
fill(245,244,237);
rect(655,355,40,40);
fill(0);
text(c11,665,355,40,40)
}
else if(mcolor => 1){
textSize(30);
String c1 = "1";
String c2 = "2";
String c3 = "3";
String c4 = "4";
String c5 = "5";
String c6 = "6";
String c7 = "7";
String c8 = "8";
String c9 = "9";
String c10 = "0";
String c11 = "o";
stroke(0);
//red
fill(255,0,0);
rect(5,355,40,40);
fill(0);
text(c1,15,355,40,40);
//green
fill(0,255,0);
rect(55,355,40,40);
fill(0);
text(c2,65,355,40,40);
//blue
fill(0,0,255);
rect(105,355,40,40);
fill(0);
text(c3,115,355,40,40);
//yellow
fill(255,255,0);
rect(155,355,40,40);
fill(0);
text(c4,165,355,40,40);
//black
stroke(255);
fill(0);
rect(205,355,40,40);
fill(255);
text(c5,215,355,40,40);
//orange
stroke(0);
fill(255,127.5,0);
rect(255,355,40,40);
fill(0);
text(c6,265,355,40,40);
//purple
fill(127.5,0,255);
rect(305,355,40,40);
fill(0);
text(c7,315,355,40,40);
//white
fill(255);
rect(355,355,40,40);
fill(0);
text(c8,365,355,40,40);
//grey
fill(150);
rect(405,355,40,40);
fill(0);
text(c9,415,355,40,40);
//cyan
fill(0,255,255);
rect(455,355,40,40);
fill(0);
text(c10,465,355,40,40);
//eraser
fill(245,244,237);
rect(655,355,40,40);
fill(0);
text(c11,665,355,40,40);
}
}
else if(menuOpt == 3){
fill(colorr,colorg,colorb);
ellipse(350,200,brushs,brushs);
}
}
void keyPressed () {
if(menuOpt == 0){
switch(key){
case 'e':
menuOpt +=1;
break;
}
}
else if(menuOpt == 2){
switch(key){
case 'm':
mcolor +=1;
break;
case '1':
colorr = 255;
colorg = 0;
color b = 0;
break;
case '2':
colorr = 0;
colorg = 255;
colorb = 0;
break;
case '3':
colorr = 0;
colorg = 0;
colorb = 255;
break;
case '4':
colorr = 255;
colorg = 255;
colorb = 0;
break;
case '5':
colorr = 0;
colorg = 0;
colorb = 0;
break;
case '6':
colorr = 255;
colorg = 127.5;
colorb = 0;
break;
case '7':
colorr = 127.5;
colorg = 0;
colorb = 255;
break;
case '8':
colorr = 255;
colorg = 255;
colorb = 255;
break;
case '9':
colorr = 150;
colorg = 150;
colorb = 150;
break;
case '0':
colorr = 0;
colorg = 255;
colorb = 255;
break;
case 'o':
colorr = 245;
colorg = 244;
colorb = 237;
break;
case 'i':
menuOpt -=2;
break;
case 'r':
menuOpt -=1;
break;
case 'a':
brushs = 10;
break;
case 's':
brushs = 20;
break;
case 'd':
brushs = 30;
break;
case 'f':
brushs = 40;
break;
case 'g':
brushs = 50;
break;
case 'h':
brushs = 60;
break;
case 'j':
brushs = 70;
break;
case 'k':
brushs = 80;
break;
case 'l':
brushs = 90;
break;
case ';':
brushs = 100;
break;
}
}
}
void mouseDragged () {
noStroke();
fill(colorr,colorg,colorb);
ellipse(mouseX,mouseY,brushs,brushs);
}