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 › Conditional size
Page Index Toggle Pages: 1
Conditional size (Read 2059 times)
Conditional size
Jun 16th, 2010, 5:38am
Just making sure... it's completely impossible to set the size parameters depending on some external variable, right?
Re: Conditional size
Reply #1 - Jun 16th, 2010, 5:54am
no, wouldnt say so. could you be a bit more clear about your "external variables"
Re: Conditional size
Reply #2 - Jun 16th, 2010, 6:07am
Not sure what you have in mind exactly, but there are ways to do it.

For example:
void setup() {
  size(width, height, P2D);

void draw() {
  rect(width/3, height/3, width/3, height/3);

If you export this sketch as an applet and open the index.html file with a text editor, you'll find a section that looks like this:
	  var attributes = { code:'SizeTest.class',
archive: 'SizeTest.jar',
width:100, height:100 } ;

("SizeTest" is what I named the sketch when I saved it, so obviously that will vary.)  If you change the numbers next to "width" and "height" you can force the applet to load at any size you choose.

So that's one way to make it work at least.  What did you have in mind?
Re: Conditional size
Reply #3 - Jun 16th, 2010, 8:43am
There's an article about this on the wiki (ex-hacks section):
Page Index Toggle Pages: 1