I think I worded my question wrong. I want to have a single sketch and move it from one display to another when I press a key, the example seems to be bouncing between two sketches already initialized on two different screens.
This works great in development mode. But when I export the application and run the sketch the projector sketch doesnt run properly. Sometimes it runs, sometimes I get a weird gray screen with a small box in the center or the corner. Here is the code:
//Output sketch
Projector projector;
//Output window dimensions
int scrW, scrH;
//This is used to determine the dimensions of the output display
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
int numberofScreens = devices.length;
PImage bg;
void setup()
{
bg = loadImage("img.jpg");
sH = bg.width;
sV = bg.height;
size(sH,sV);
scrW = devices[0].getDefaultConfiguration().getBounds().width;
scrH = devices[0].getDefaultConfiguration().getBounds().height;
//Load with controls on the page
setMode = true;
final String[] projectorArgs = {
"--display=1",
"--present",
"--sketch-path=" + sketchPath,
""
};
try
{
projector = new Projector(scrW, scrH); // instantiate
runSketch(projectorArgs, projector); // ignite
}
catch(Exception e)
{
}
}
Answers
https://forum.Processing.org/two/discussion/11304/multiple-monitors-primary-dragable-secondary-fullscreen
Thanks for replying. So lets say I want to switch screens halfway in a sketch, would this work?
https://forum.Processing.org/two/discussion/comment/43044/#Comment_43044
I think I worded my question wrong. I want to have a single sketch and move it from one display to another when I press a key, the example seems to be bouncing between two sketches already initialized on two different screens.
This makes the sketch full screen? How do I move it from my main screen to a monitor I've attached?
Cool, but it looks like the string array 'monitor' is final. How can you change it in the middle of a sketch? Will this work?
static final void main(final String[] args) {}
method is to instantiate the whole sketch.image(pg, 0, 0, width, height);
Thanks so much! I think I understand what I need to do now.
Another question. Is it possible to make an array of PApplets? I'm thinking of getting the number of displays using the following way:
And using this integer to create 1 PApplet for each screen. Then I can just switch back and forth using enable / disable.
image(pg, 0, 0, width, height);
https://Processing.org/reference/image_.htmlThis works great in development mode. But when I export the application and run the sketch the projector sketch doesnt run properly. Sometimes it runs, sometimes I get a weird gray screen with a small box in the center or the corner. Here is the code:
Am I doing something wrong?