Hello. I'm developing a program in Processing which will be displayed in a museum, for a company I'm working for. The problem is, I need to use a touchscreen to interact with a projection, i.e. I have to display different visual patterns depending on what the users clicks on the touchscreen menu, and then use the mouseX,mouseY coordinated of the users finger to navigate the other monitor.
Ok, so far so good, as I figured I could just write a client/server program, having the server be the first monitor (ie, the projection on the wall) and the client the second monitor (ie, the touchscreen). Such that I can connect them both through a localhost connection, and have no problems in telling the first program window to go to monitor 1 and the second program window go to monitor 2.
Is this feasible? Can I just do something like
Code:
import java.lang.Thread;
MyServer server=new MyServer;
void setup(){
server.start();
}
void draw(){
//Draw whatever the server receives from the client.
//Ie. Button 1 pressed - Display slideshow 1, else draw..
//etc.
}
class MyServer extends Thread{
public void run(){
//keep receiveing client packets, and storing it
//in an input buffer.
}
}
And the client something like:
Code:
import java.lang.Thread;
MyClient client=new MyClient;
void setup(){
client.start();
}
void draw(){
//Draw menu, if button 1 pressed, send to server
//"button 1 pressed"
//and then turn black, display a cursor and start sending
//mouseX,mouseY coordinates to the server
}
class MyClient extends Thread{
public void run(){
//keep sending whatever the client puts in the
//output buffer to be sent to the server
}
}
Can it be done as easy? I'm aware and know how to use locks and etc, just want to know if such design would work inside Processings IDE, or if I would have to use my full blown NetBeans IDE to extend the PApplet and etc?
Please tell me it can be done, I need to build this in the next week :/
Thanks for the help!
***EDIT***
Of course, if anyone can suggest some other solution on how to use a touchscreen to control another Processing program or make one Processing program for 2 monitors, please let me know. I will me most thankful.