Paint Pallette
in
Programming Questions
•
8 months ago
I'm trying to make a very very dumbed down MS Paint program where when you select any of the three colors and click and hold down, a circle or "brush" will appear with the color of which you just selected. Totally stuck. Any suggestions?
- int red;
- int redX = 200;
- int redY = 30;
- int redSize = 35;
- int green;
- int greenX = 400;
- int greenY = 30;
- int greenSize = 35;
- int blue;
- int blueX = 600;
- int blueY = 30;
- int blueSize = 35;
- color currentColor;
- void setup() {
- size(800,800);
- background(random(255),random(255),random(255));
- frameRate(60);
- red = color(255,0,0);
- green = color(0,255,0);
- blue = color(0,0,255);
- }
- void draw() {
- fill(red);
- ellipse(redX,redY,redSize,redSize);
- fill(green);
- ellipse(greenX,greenY,greenSize,greenSize);
- fill(blue);
- ellipse(blueX,blueY,blueSize,blueSize);
- }
- }
- if (mousePressed && mouseButton == LEFT); {
- noStroke();
- fill(currentColor);
- if (mousePressed && mouseButton == LEFT); {
- if ((mouseX > redX) & (mouseY > redY) & (mouseX > redX + redSize) & (mouseY > redY + redSize)){
- currentColor = color(red);
- }
- }
- }
1