class Button { float cx; float cy; float h; float w; int son; //shade int soff; float von; //value float voff; int state; //0 off, 1 on Button(float cx_, float cy_, float h_, float w_, int son_, int soff_, float von_, float voff_, int state_) { cx=cx_; cy=cy_; h=h_; w=w_; son=son_; soff=soff_; von=von_; voff=voff_; state=state_; } void render() { noStroke(); if(state==1) { fill(son);} else { fill(soff);} rect(cx-w/2, cy-h/2, w, h); }//END render float givev() { float returnval; if(state==1) {returnval=von;} else {returnval=voff;} return returnval; }//END givev void pressed(float xin, float yin) { if( (xin > cx-w/2) && (xin < cx+w/2) && (yin > cy-h/2) && (yin < cy+h/2)) { if(state==1) { state=0;} else { state=1;} } }//END pressed }//END Button