I came up with a new problem I think I'm learning fast
but here's the problem:
int x1;
int y1;
int x2;
int y2;
int w;
int r;
int g;
int b;
void setup() {
size(800, 450);
background(255, 255, 255);
cursor(CROSS);
noLoop();
}
void draw() {
stroke(r,g,b);
strokeWeight(w);
fill(r,g,b);
line(x1, y1,x2,y2);
line(-x1+800, y1,-x2+800,y2);
stroke(200);
strokeWeight(0);
line(400,0,400,450);
}
void mouseDragged() {
redraw();
x2=mouseX;
y2=mouseY;
x1=pmouseX;
y1=pmouseY;
if (mouseButton == RIGHT){
r=255;
g=255;
b=255;
}
}
void mousePressed() {
redraw();
x2=mouseX;
y2=mouseY;
x1=pmouseX;
y1=pmouseY;
if (mouseButton == RIGHT){
r=255;
g=255;
b=255;
}
}
void keyPressed() {
if (keyCode == ENTER) {
saveFrame("screenshot##.png");
}
if (keyCode == UP) {
w=w+1;
}
if (keyCode == DOWN) {
if (w!=0){
w=w-1;
}
}
}
void mouseReleased(){
noLoop();
if (mouseButton == RIGHT){
r=0;
g=0;
b=0;
}
}
I wrote acode for like a drawing program
what I want it to do is when I press r button and use right and left keys I want the r value to increase then when I press g and b buttons I wnat it to do this same thing for them. There is another problem though there is a
void mouseReleased(){
noLoop();
if (mouseButton == RIGHT){
r=0;
g=0;
b=0;
}
}
code which would make all my values back to zero I want to use sth like saveString() and loadString() so that it saves the r g b values I give by increasing or decreasing and when I release the right button it goes back to the saved values.. is it too hard to do I dont know the logic seemed very possible to me but I dnt know how to code it exactly?????