Hello. I want to finish my processing paint program but I ran into some complications.
My goal is to take out the grey rectangle and move the squares on the right hand side of the GUI Screen on the Y axis in a single vertical column. Once thats done I want to include the circles and finaly the Eraser.
Please don't go totally overboard on this I am a newbie so when you want to make a suggestion show your code but
explain it so that I can comprehend this tnx.
Here is what I have so far...
class Button {
color c;
boolean isRect;
float h;
float w;
float x;
float y;
Button() {
h = 20;
w = 20;
}
Button(color cVal, boolean isRectVal, float xVal, float yVal) {
this(); // call base constructor
c = cVal;
isRect = isRectVal;
x = xVal;
y = yVal;
}
boolean within(float xVal, float yVal) {
if (isRect) {
return(xVal > x - w/2 && xVal < x + w/2 && yVal > y - h/2 && yVal < y + h/2);
} else {
// assume a circle
return(dist(xVal, yVal, x, y) < h/2);
}
}
for (int i = 0; i < colorButton.length; i++) { // cycle through each button
if (colorButton[i].within(mouseX, mouseY)) { // is the mouse within the button's space
switch(i) { // is so hanle based on i, or the button
case 0:
currentColor = Yellow;
typeIsRect = true;
break;
case 1:
currentColor = Red;
typeIsRect = true;
break;
case 2:
currentColor = Green;
typeIsRect = true;
break;
case 3:
currentColor = Blue;
typeIsRect = true;
break;
case 4:
currentColor = Orange
typeIsRect = true
break;
case 5:
currentColor = Yellow;
typeIsRect = false;
break;
case 5:
currentColor = Red;
typeIsRect = false;
break;
case 6:
currentColor = Green;
typeIsRect = false;
break;
case 7:
currentColor = Blue;
typeIsRect = false;
break;
currentColor = Orange;
typeIsRect = false;
break;
}
}
}
}
}
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;