class Gauge { float curVal; float step; Gauge() { curVal = 0; step = 0.05; } float get() { return curVal; } void set(float newVal) { curVal = newVal; } void increment() { curVal += step; curVal = constrain(curVal, 0, 1); } void decrement() { curVal -= step; curVal = constrain(curVal, 0, 1); } void display() { stroke(0); fill(255); rect(0, 0, 100, 15); noStroke(); fill(0); rect(1, 1, 99*curVal, 14); } }