PShape gauge_BW; PShape gauge_R; PShape gauge_G; PShape gauge_B; int BW_level; int R_level; int G_level; int B_level; int Y_BW; int Y_R; int Y_G; int Y_B; boolean RGB_switch; PImage switch_Pic_RGB; PImage switch_Pic_BW; int L; void setup() { size(800, 500); switch_Pic_RGB = loadImage("rgb.jpg"); switch_Pic_BW = loadImage("bw.jpg"); BW_level=0; R_level=0; G_level=0; B_level=0; RGB_switch=false; L = width/18; // to get something "balanced", I will often use the value width/18 // so instead of writing it a lot of times, I name it L. It's shorter. } void draw() { fill(255); if (RGB_switch){ background(R_level,G_level,B_level); rect(0,0,width/2,height); image(switch_Pic_RGB,5,5); } else {background(0); rect(0,0,width/2,height); image(switch_Pic_BW,5,5); } fill(0); textSize(20); text("B/W", L,height-20); text(BW_level,L,80); fill(255,0,0); text("R", 3.35*L,height-20); text(R_level,3*L,80); fill(0,255,0); text("G", 5.35*L,height-20); text(G_level,5*L,80); fill(0,0,255); text("B", 7.35*L,height-20); text(B_level,7*L,80); // I want to draw a gauge as a triangle. // here it's just 3 lines, not a shape, so the background doesn't change. line(L,height-50,L,100); line(L,100,2*L,100); line(2*L,100,L,height-50); // I'll draw the others as rectangles. // Here it's a shape (rect) so the background is of the color set by the last fill(). // If I don't change anything, it will be blue. fill(255); rect(3*L,100,L,height-150); rect(5*L,100,L,height-150); rect(7*L,100,L,height-150); } boolean over_RGB_switch() { return ((mouseX - 20)*(mouseX - 20) +(mouseY - 20)*(mouseY - 20) < 400 ); } boolean over_BW_gauge() { return mouseX>=L && mouseX<=2L && mouseY>100 && mouseY=3L && mouseX<=4L && mouseY>100 && mouseY=5L && mouseX<=6L && mouseY>100 && mouseY=7L && mouseX<=8L && mouseY>100 && mouseY