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 › test for "present" mode  (similar
Page Index Toggle Pages: 1
test for "present" mode?  (similar (Read 533 times)
test for "present" mode?  (similar
May 24th, 2007, 4:10pm
 
Processing has a variable "online" that indicates whether or not
a Processing sketch is running in a web browser.

I am hunting for a similar variable to indicate whether a Processing sketch
is running in "present" mode.  Does one exist?

Here is the code I'd like to run:

if (present) {
 size(screen.width,screen.height);
} else {
 size(600,400);
}

I have searched the Processing documentation online
and I can't find something appropriate.

As a hack, I discovered that g.width1 is 99 in an applet
and 899 in present mode, so I tried this workaround:

 println("w = " + g.width1 + " h = " + g.height1);
 if (g.width1 > 100) {
   size(screen.width,screen.height,OPENGL);
 } else {
   size(900,600,OPENGL);
 }

This *almost* works.  In present mode, the origin of the drawing
is offset from the top-left corner, even though the size is the full screen.

Does anyone know how to explicitly set the top-left corner of the drawing?

It seems that when exporting, Processing must snoop inside my code
and find the constants 900 and 600 and set the ORIGIN to be appropriate
for 900x600, even though I choose the other screen size
(which is 2560x1660).

-- djones
Page Index Toggle Pages: 1