class Button { Tree example; int control; float cx; float cy; float h; float w; int son; //shade int soff; float von; //value float voff; int state; //0 off, 1 on boolean renderT; Button(int control_, float cx_, float cy_, float h_, float w_, int son_, int soff_, float von_, float voff_, int state_) { control=control_; cx=cx_; cy=cy_; h=h_; w=w_; son=son_; soff=soff_; von=von_; voff=voff_; state=state_; example= new Tree(cx, cy, 90, 15, 6, 100); renderT=true; } void setCX(float x) {cx=x;} float getCX() {return cx;} void setCY(float y) {cy=y;} float getCY() {return cy;} void setSON(int s) {son=s;} void setSOFF(int s) {soff=s;} void setRENDERT(boolean in){renderT=in;} void render() { noStroke(); if(state==1) { fill(son);} else { fill(soff);} if(renderT==true) { example.render(); noStroke(); example.controltree(control,second()%6); example.update(); if(millis()%50==0) { example.regenerate();} } 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