We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › multisketch or multiple windows without borders
Page Index Toggle Pages: 1
multisketch or multiple windows without borders (Read 1257 times)
multisketch or multiple windows without borders
Sep 1st, 2009, 3:37pm
 
Hi , im using the library processing utils that allows to create a lot of windows from open processing file. I usually use the following function for having my window without borders in processing:
void init()
{
 frame.removeNotify();
 frame.setUndecorated(true);
 frame.addNotify();
 super.init();
}


but the thing is when i use the multisketch library and i do the same it just work for my main window, if i put the same code inside the class of my other windows i get error, So i have basically 3 questions, what does frame means?  what does super means? and do anybody have an idea of how to make it work for all my windows in my multiskectch skecth?

thanks


pun.
Re: multisketch or multiple windows without borders
Reply #1 - Sep 2nd, 2009, 6:53am
 
frame is the AWT Frame window Processing creates to show the sketch.
super refers to the parent class. Your sketch is actually enclosed in a class (of same name as your sketch) which extends PApplet, so super.init() allows to execute whatever init code PApplet can have, in addition to your own code.

Not sure how to answer your last question, "i get error" isn't very precise.
Re: multisketch or multiple windows without borders
Reply #2 - Sep 2nd, 2009, 7:34am
 
Hi phiLho, for example in the multisketchExample that comes with processing utils library, i would like to have both windows withouth borders . If i put the void init fuction inside the multisketchExample tab it works just for my first window, it appears withouth borders , but if i put the same function inside the tab AnotherSketch , it doesnt run and i get NullPointerException.   Do you know what is going on , and how can i have both windows withouth borders?

many thanks


P.
Re: multisketch or multiple windows without borders
Reply #3 - Sep 2nd, 2009, 8:01am
 
I have no idea where you got your multisketch example.

If AnotherSketch creates a class, you have to pass the PApplet instance to it.
Re: multisketch or multiple windows without borders
Reply #4 - Sep 2nd, 2009, 8:11am
 
Hi , multisketch example comes with processing utilities library, here is the code:

what do you mean to pass the PApplet instance to it?

Code:



import org.gicentre.processing.utils.multisketch.*;

// Simple example to show how two sketches can be created in separate windows.
// Version 1.2, 18th July, 2009.
// Author Jo Wood.

// ----------------------- Object variables -------------------------

float rotationAngle;

// ----------------------- Initialisation ---------------------------

/** Sets up this sketch and adds another sketch in a separate window.
*/
void setup()
{
size(300,300);
PFont font = createFont("Serif",32);
textFont(font, 32);
smooth();
textAlign(CENTER,CENTER);
fill(120,20,20);
rotationAngle = 0;

PopupWindow win = new PopupWindow(this,new AnotherSketch());
win.setVisible(true);
}

// ----------------------- Processing draw --------------------------


void init()
{
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}
/** Displays some text and animates its rotation.
*/
void draw()
{
background(255,200,200);

pushMatrix();
translate(width/2,height/2);
rotate(rotationAngle);
text("Hello world",0,0);
popMatrix();

rotationAngle += 0.01;
}


Code:
// Simple embedded sketch that can be placed in its own window.
// Version 1.2, 18th July, 2009.
// Author Jo Wood.

public class AnotherSketch extends EmbeddedSketch
{
// ----------------------- Object variables -------------------------

float textScale;

// ----------------------- Initialisation ---------------------------

/** Initialises the sketch ready to display some animated text.
*/
void setup()
{
size(300,300);
PFont font = createFont("SansSerif",24);
textFont(font, 24);
smooth();
textAlign(CENTER,CENTER);
fill(20,120,20);
textScale = 0;
}


void init()
{
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}

// ----------------------- Processing draw --------------------------

/** Displays some text and animates a change in size.
*/
void draw()
{
super.draw(); // Should be the first line of draw().
background(200,255,200);

pushMatrix();
translate(width/2,height/2);
scale(0.1+sin(textScale),1);
text("Hello again",0,0);
popMatrix();

textScale += 0.02;
}
}
Re: multisketch or multiple windows without borders
Reply #5 - Sep 2nd, 2009, 8:44am
 
Sorry, but I don't know this library. Not knowing what a EmbeddedSketch is, it is hard to advice.
Page Index Toggle Pages: 1