Hi there, past days with the special help of this forum i archive some tools such toggle and button, i need it for multitouch purpose on android, i understand that mouse parameter are not correct for multitouch, i already read what there is on processing android site but i phish to obtain a little help to convert this class for android multi touch purpose. Thanks a lot
class Toggle {
boolean state;
boolean ready;
boolean blink;
int x, y, w, h, delta; // x,y,w,h
Toggle(int ix, int iy, int iw, int ih) {
blink = false;
state = false;
ready = true;
x = ix;
y = iy;
w = iw;
h = ih;
}
void draw() {
if(blink == true){delta = 32;} else {delta = 0;}
if ( mousePressed ) {
if (ready && mouseX >= x && mouseX <= (x+w) && mouseY >= y && mouseY <= (y+h) ) {
ready = false;
state = !state;
}
} else {
ready = true;
}
fill(63+delta);
if (state) {
fill(127+delta);
}
rect(x, y, w, h);
}
}