Hello,
today i just tried to get in the P5 library and slightly changed one of the example scripts. i now can change the background color but actually i want to make it possible to draw some stuff on the screen, and if i'd like to, i can change the background color again without deleting the stuff i've drawn so far.
so let's say, first i choose a green background, then i draw something (the function for drawing is not yet in the script) and then change the background to red. but the drawn stuff has to stay on the screen.
hope for your help - the library is great, can't wait to start working with it
*thumbs up*
import controlP5.*;
ControlP5 controlP5;
int myColorBackground = color(0,0,0);
ControlWindow controlWindow;
public int R = 40;
public int G = 40;
public int B = 40;
void setup() {
size(400,400);
frameRate(25);
controlP5 = new ControlP5(this);
controlP5.setAutoDraw(false);
controlWindow = controlP5.addControlWindow("controlP5window",100,100,200 ,400);
controlWindow.setBackground(color(40));
Controller mySlider1 = controlP5.addSlider("R",0,255,40,20,100,10);
Controller mySlider2 = controlP5.addSlider("G",0,255,40,40,100,10);
Controller mySlider3 = controlP5.addSlider("B",0,255,40,60,100,10);
mySlider1.setWindow(controlWindow);
mySlider2.setWindow(controlWindow);
mySlider3.setWindow(controlWindow);
}
void draw() {
background(R, G, B);
controlP5.draw();
}
void keyPressed() {
if(key==',') controlP5.window("controlP5window").hide();
if(key=='.') controlP5.window("controlP5window").show();
// controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200);
// controlP5.controller("sliderValue1").moveTo(controlWindow);
}