second screen
in
Programming Questions
•
3 years ago
Hello,
I'm currently working with a sketch that interacts with max/msp (made by a colleague).
Sound and movements on a dance mat are transformed into a drawing.
First of all: sorry if I'm not using the right processing vocabulary. I'm an absolute beginner...
I have a problem with working with two screens. My processing window (where the drawing happens when running the processing sketch and max patch) should open on the second screen, but it only does if I move the white bar in the screen preferences to the second screen. But then the menu bar on top and the dock below are also on the second screen.
But this is very annoying because whenever for example a student is using this application and I want to change something for example in the max-patch or open a new program I have to interfere with the drawing on the second screen.
So, what I need is the possibility to bring the processing window (when running) to the second screen, but keep everything else on the screen of my laptop.
I hope my explanation was clear enough to understand the problem.
Can somebody help me?
here's the code:
// import libraries for Open Sound Control
import oscP5.*;
import netP5.*;
// create new instance for OSC plugging
OscP5 oscP5;
NetAddress toMax;
OscMessage startRecord = new OscMessage("/startRecord");
// create a new brush
Brush myBrush;
// create index for saving/loading pictures
int iP;
int d=50;
String[] lines;
int indexLines=0;
boolean aGo= false;
boolean noteOn=true;
boolean recState=false;
float xPos;
float yPos;
int indexColor=0;
color[] colors;
/*main in order t be able to do fullscreen application*/
static public void main(String args[]){
PApplet.main(new String[] {"--present", "brusher"});
}
/* setup */
void setup(){
//concerning the window
smooth();
size(screen.width,screen.height);
// size(screen.width,screen.height);
background(255);
println("#width "+screen.width);
println("#height "+screen.height);
lines=loadStrings("/Users/lucnijs/Documents/Processing/brusher/data/colorList.txt");
println("#kleuren"+lines.length);
colors= new color[lines.length];
for(int i=0; i<lines.length;i++){
colors[i]=unhex(lines[i]);
}
// sending to max
toMax = new NetAddress("127.0.0.1",12001);
// stuff for OSC and plugging to void
oscP5 = new OscP5(this,12000);
oscP5.plug(this,"position","/position");
oscP5.plug(this,"colors","/colors");
oscP5.plug(this,"indexColors","/indexColors");
oscP5.plug(this,"setSize","/setSize");
oscP5.plug(this,"startStop","/startStop");
oscP5.plug(this,"setBrush","/setBrush");
oscP5.plug(this,"noteOn","/noteOn");
oscP5.plug(this,"transparency","/transparency");
oscP5.plug(this,"clear","/clear");
//new instance myBrush has (xPos, yPos, diameter, softness, color ) variable
myBrush=new Brush (xPos, yPos, 10 , 0 , colors[indexColor]);
// index for saving set to 0
iP=0;
// create the screenSize message for max
OscMessage screenSize = new OscMessage("/screenSize");
screenSize.add(screen.width);
screenSize.add(screen.height);
// sending the screenSize to max
oscP5.send(screenSize,toMax);
// create the screenSize message for max
setLine();
}
/* draw */
void draw(){
noStroke();
//myBrush.brushDraw();
if(aGo){
if(noteOn){
myBrush.drawB();
}
}
}
public void position(float x, float y){
xPos= x;
yPos= y;
myBrush.rePos(xPos,yPos);
}
public void indexColors(int i){
indexColor=i;
myBrush.setIndexColor(indexColor);
//println(indexColor);
}
public void colors(int r,int g,int b,int a){
myBrush.setColor(r,g,b,a);
//println(indexColor);
}
public void setSize(float d){
myBrush.setSize(d);
println(d);
}
public void startStop(int b){
if(b==1){
clear();
aGo=true;
}else{
aGo=false;
}
}
public void setBrush(int i){
myBrush.setBrush(i);
}
public void noteOn(int i){
if(i==1) noteOn=true;
else noteOn=false;
}
public void transparency(float f){
myBrush.setTransparency(f);
}
public void clear(){
background(255);
}
public void setLine(){
line(screen.width/2,0,screen.width/2,screen.height);
}
Thanks and greetings,
Luc
I'm currently working with a sketch that interacts with max/msp (made by a colleague).
Sound and movements on a dance mat are transformed into a drawing.
First of all: sorry if I'm not using the right processing vocabulary. I'm an absolute beginner...
I have a problem with working with two screens. My processing window (where the drawing happens when running the processing sketch and max patch) should open on the second screen, but it only does if I move the white bar in the screen preferences to the second screen. But then the menu bar on top and the dock below are also on the second screen.
But this is very annoying because whenever for example a student is using this application and I want to change something for example in the max-patch or open a new program I have to interfere with the drawing on the second screen.
So, what I need is the possibility to bring the processing window (when running) to the second screen, but keep everything else on the screen of my laptop.
I hope my explanation was clear enough to understand the problem.
Can somebody help me?
here's the code:
// import libraries for Open Sound Control
import oscP5.*;
import netP5.*;
// create new instance for OSC plugging
OscP5 oscP5;
NetAddress toMax;
OscMessage startRecord = new OscMessage("/startRecord");
// create a new brush
Brush myBrush;
// create index for saving/loading pictures
int iP;
int d=50;
String[] lines;
int indexLines=0;
boolean aGo= false;
boolean noteOn=true;
boolean recState=false;
float xPos;
float yPos;
int indexColor=0;
color[] colors;
/*main in order t be able to do fullscreen application*/
static public void main(String args[]){
PApplet.main(new String[] {"--present", "brusher"});
}
/* setup */
void setup(){
//concerning the window
smooth();
size(screen.width,screen.height);
// size(screen.width,screen.height);
background(255);
println("#width "+screen.width);
println("#height "+screen.height);
lines=loadStrings("/Users/lucnijs/Documents/Processing/brusher/data/colorList.txt");
println("#kleuren"+lines.length);
colors= new color[lines.length];
for(int i=0; i<lines.length;i++){
colors[i]=unhex(lines[i]);
}
// sending to max
toMax = new NetAddress("127.0.0.1",12001);
// stuff for OSC and plugging to void
oscP5 = new OscP5(this,12000);
oscP5.plug(this,"position","/position");
oscP5.plug(this,"colors","/colors");
oscP5.plug(this,"indexColors","/indexColors");
oscP5.plug(this,"setSize","/setSize");
oscP5.plug(this,"startStop","/startStop");
oscP5.plug(this,"setBrush","/setBrush");
oscP5.plug(this,"noteOn","/noteOn");
oscP5.plug(this,"transparency","/transparency");
oscP5.plug(this,"clear","/clear");
//new instance myBrush has (xPos, yPos, diameter, softness, color ) variable
myBrush=new Brush (xPos, yPos, 10 , 0 , colors[indexColor]);
// index for saving set to 0
iP=0;
// create the screenSize message for max
OscMessage screenSize = new OscMessage("/screenSize");
screenSize.add(screen.width);
screenSize.add(screen.height);
// sending the screenSize to max
oscP5.send(screenSize,toMax);
// create the screenSize message for max
setLine();
}
/* draw */
void draw(){
noStroke();
//myBrush.brushDraw();
if(aGo){
if(noteOn){
myBrush.drawB();
}
}
}
public void position(float x, float y){
xPos= x;
yPos= y;
myBrush.rePos(xPos,yPos);
}
public void indexColors(int i){
indexColor=i;
myBrush.setIndexColor(indexColor);
//println(indexColor);
}
public void colors(int r,int g,int b,int a){
myBrush.setColor(r,g,b,a);
//println(indexColor);
}
public void setSize(float d){
myBrush.setSize(d);
println(d);
}
public void startStop(int b){
if(b==1){
clear();
aGo=true;
}else{
aGo=false;
}
}
public void setBrush(int i){
myBrush.setBrush(i);
}
public void noteOn(int i){
if(i==1) noteOn=true;
else noteOn=false;
}
public void transparency(float f){
myBrush.setTransparency(f);
}
public void clear(){
background(255);
}
public void setLine(){
line(screen.width/2,0,screen.width/2,screen.height);
}
Thanks and greetings,
Luc
1