Hi,
dont know if it helps, but you can also create multiple PApplets in one sketch and abuse processings setting of all variables being global to communticate inbetween the single windows.
this code below is very quick and dirty, but it's just to give an simple example:
Code:UIWindow uiWindow;
boolean draw_circles= false;
void setup() {
size(500, 200);
background(102);
smooth();
frame.setTitle("output window");
//init second window
uiWindow = new UIWindow( 500,240 );
frameRate(25);
}
void draw() {
frame.setLocation(screen.width-455,100); //just finxing the location of the frame
}
//some stuff from the 'examples' we want to do
void variableEllipse(int x, int y, int px, int py) {
float speed = abs(x-px) + abs(y-py);
stroke(speed);
ellipse(x, y, speed, speed); //quick and dirty, but as we call ellipse() here it is drawn to the default(first) window
}
//second window like e.g. Edvin_Besic postet
public class UIWindow extends PApplet {
Frame frame;
int width;
int height;
int col = 0;
UIWindow (int w, int h)
{
width = w;
height = h;
frame = new Frame();
frame.setBounds(0, 0, width, height);
frame.setLocation(screen.width-455,350);
frame.add(this);
this.init();
frame.show();
frameRate(25);
}
void setup( )
{
size(width,height);
frame.setTitle("input window");
noStroke();
}
void draw ( ){
variableEllipse(mouseX, mouseY, pmouseX, pmouseY); //call variableEllipse() that draws to the first window
//but we can also do some stuff here
fill(col,20,0);
rect(0,0,460,col);
col++;
if(col>=255) col = 0;
}
}
when doing things like this you only have to put an eye on not getting confused by too many globals.
cheers