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.
IndexSuggestions & BugsSoftware,  Documentation,  Website Suggestions › size(0,0), this.show(), and a spash screen
Page Index Toggle Pages: 1
size(0,0), this.show(), and a spash screen (Read 966 times)
size(0,0), this.show(), and a spash screen
Aug 3rd, 2006, 7:50pm
 
Hi,
I am making an app that I would like to have a splash screen:

Code:

Frame splash;
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
splash.setBounds(dim.width/2-160,dim.height/2-120,320,240);
splash.show();

Graphics splashGraf= splash.getGraphics();
splashGraf.setColor(Color.red);
splashGraf.fillOval(20, 20, 20, 20);
splash.paint(splashGraf);
splash.toFront();

//load a bunch of stuff

splash.hide();

(this code works)

And it would be helpful if I could have the window invisable from the start via size(0,0); (IE: be hidden until a this.show() function is called).

currently I call:
Code:

size(1,1);
this.frame.hide();

to hide the window and
Code:

this.frame.setBounds(dim.width/2-320,dim.height/2-240,640,480);
this.frame.show();

to show it at the size that I want.

This results in a split second flash of the main processing window sized at 128x128 or whatever the minumum is before this.frame.hide();
Re: size(0,0), this.show(), and a spash screen
Reply #1 - Aug 3rd, 2006, 8:59pm
 
make your own main(), in which you do your splash code. once the thing is done, call PApplet.main(new String[] { "yoursketchname" }); to launch the sketch.
Re: size(0,0), this.show(), and a spash screen
Reply #2 - Aug 4th, 2006, 9:31pm
 
does this have to be in Java mode?

Re: size(0,0), this.show(), and a spash screen
Reply #3 - Nov 18th, 2006, 3:06pm
 
I know it's archaic, but I've found the following method to be rather effective in making a splash screen:

Code:

boolean splash = false;

void draw()
{
  if(splash) { drawSplash();}
  else {...}
}

void drawSplash(){...}


From there, it should be pretty easy to set up the appropriate triggers (mousePressed(), etc.) to get to the rest of your app.
Page Index Toggle Pages: 1