class xSlider { float sx; float sy; float h; float w; float bh; float bw; float bpos; float minV; float maxV; int scolor; int bcolor; xSlider( float sx_, float sy_, float w_, float bpos_, float minV_, float maxV_) { sx=sx_; sy=sy_; w=w_; bpos=bpos_; minV=minV_; maxV=maxV_; h=5; bh=10; bw=10; scolor=150; bcolor=255; } float givev() { //slide is linear return (bpos-sx)/w*(maxV-minV)+minV; } void pressed(float xin, float yin) { if((yin > sy-bh/2) && (yin < sy+bh/2)) { if( (xin > sx) && (xin < sx+w) ) { bpos=xin; } } }//END pressed void render() { //render slide noStroke(); fill(scolor); rect(sx, sy-h/2,w,h); //render button noStroke(); fill(bcolor); rect(bpos-bw/2, sy-bh/2, bw, bh); }//END render }//END xSlider class ySlider { float sx; float sy; float h; float w; float bh; float bw; float bpos; float minV; float maxV; int scolor; int bcolor; ySlider( float sx_, float sy_, float h_, float bpos_, float minV_, float maxV_) { sx=sx_; sy=sy_; h=h_; bpos=bpos_; minV=minV_; maxV=maxV_; w=5; bh=10; bw=10; scolor=150; bcolor=255; } float givev() { //slide is linear return (bpos-sy)/h*(maxV-minV)+minV; } void pressed(float xin, float yin) { if( (xin > sx-bw/2) && (xin < sx+bw/2) && (yin > bpos-bh/2) && (yin < bpos+bh/2)) { if( (yin > sy) && (yin < sy+h) ) { bpos=yin; } } }//END pressed void render() { //render slide noStroke(); fill(scolor); rect(sx-w/2, sy,w,h); //render button noStroke(); fill(bcolor); rect(sx-bw/2, bpos-bh/2, bw, bh); }//END render }//END ySlider