please try:
KEY PLUS PLUS
// possibly you know ( or have even tested ) my Mouse Wheel Plus Plus,
// a idea to multiplex the mouse wheel input by pressing keys
// so generating multi invisible sliders.
// now from here a other idea i want you to check out if that is a possible HMI concept:
String info = "Key Plus Plus \nfirst you press [r] or [g] or [b], next you press [+] or [-]";
// here use it on a color R G B example, but not limited to color, or only 3 "sliders"
// ( sure that has been done already somewhere, like all what we play here. )
// note: while with MWPP you must keep the key (r g b ) pressed and turn mousewheel,
// here do not keep the character keys pressed, use like [r] [+] [+] [g] [-]
int r=50, g=50, b=50;
char cmode = ' ';
color c;
//_______________________________________________ SETUP
void setup() {
size(200, 200);
colorMode(RGB, 100);
c = color(r, g, b);
println(info);
}
//_______________________________________________ DRAW
void draw() {
background(c);
}
//_______________________________________________ OPERATION Key Plus Plus
void keyPressed() {
int xdc,dc=5; //______________________________ color range 100 in steps of 5
if ( key == 'r' || key == 'g' || key == 'b' ) cmode = key;
else if ( key == '+' || key == '-' ) {
if ( key == '+' ) xdc = dc;
else xdc = -dc;
if ( cmode == 'r' ) r += xdc;
else if ( cmode == 'g' ) g += xdc;
else if ( cmode == 'b' ) b += xdc;
r = constrain(r,0,100);
g = constrain(g,0,100);
b = constrain(b,0,100);
c = color(r, g, b);
println("cmode: "+cmode+", key:"+key+", c = color( "+r+" , "+g+" , "+b+" ); of RGB 100");
}
else cmode = ' '; //__________________________ reset cmode on any other key
}
for ref also old
MOUSE WHEEL PLUS PLUS
String info = "MouseWheelPlusPlus: press\n[r] red\n[g] green\n[b] blue\nand turn mousewheel";
int r=50, g=50, b=50; // color RGB
color c;
//_______________________________________________ SETUP
void setup() {
size(200, 200);
colorMode(RGB, 100);
c = color(r, g, b);
println(info);
}
//_______________________________________________ DRAW
void draw() {
background(c);
}
//_______________________________________________ OPERATION Mouse Wheel Plus Plus
void mouseWheel(MouseEvent event) { // move mouse wheel
float e = event.getCount();
if ( keyPressed && key == 'r' ) r += e;
if ( keyPressed && key == 'g' ) g += e;
if ( keyPressed && key == 'b' ) b += e;
r = constrain(r, 0, 100);
g = constrain(g, 0, 100);
b = constrain(b, 0, 100);
println("c = color( "+r+" , "+g+" , "+b+" ); of RGB 100");
c = color(r, g, b);
}
thanks for testing and feedback.