I have multiple sketches designed to have their own toolbar using ControlP5. Individually, they run fine, but when I try to put each in its own frame, the controls only render on the last window created.
CP5_manyWindows.pde (this is the "main" sketch that ties the others together)
//CP5_manyWindows.pde
View1 v1; View2 v2;
void setup(){ PFrame v1_frame = new PFrame(v1); PFrame v2_frame = new PFrame(v2); }
void draw(){ }
public class PFrame extends Frame { public PFrame(View1 app) { setBounds(100,100,400,300); setTitle("View1"); app = new View1(); add(app); app.init(); show(); }
public PFrame(View2 app) { setBounds(100,100,400,300); setTitle("View2"); app = new View2(); add(app); app.init(); show(); } }
My overall goal is to be able to allow someone with a touchscreen device (iPhone, for example) to be able to connect to a website running javascript, and for their touch coordinates (x, y) to be sent to a Processing sketch. I know that if I can get the below working (sending 'hi' from a .js client to a Processing server), that I will be set.
My current approach is to run a server in the Processing sketch and try to send data via Javascript. However, the output is a little off (shown below). Any ideas or suggestions are greatly appreciated.
void draw() { // Get the next available client Client thisClient = myServer.available(); // If the client is not null, and says something, display what it said if (thisClient !=null) { String whatClientSaid = thisClient.readString(); if (whatClientSaid != null) { println(thisClient.ip() + "t" + whatClientSaid); } } }