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 & HelpPrograms › weird size() problem
Page Index Toggle Pages: 1
weird size() problem? (Read 347 times)
weird size() problem?
Mar 18th, 2006, 7:17am
 
Hi All -

This is really baffling - if I repeatedly start my program (by pressing "play" in the IDE), then stop it (by hitting the "x" button in the upper right hand corner of the Applet window),  it gives me different behavior each time!

Sometimes it gives me an 800x800 window with a circle in the center (which is what I intend). Sometimes it gives me a 100x100 (approximately) window with a circle in the center.  Sometimes it just gives me a blank 100x100 window.

I just upgraded from 106 to 108, and I'm still getting the weird behavior.  Can anyone give me any suggestions as to what is going on?

Code Below: (Note: I added a file called Circ2D.java - it's just a simple circle class with a Position and a radius, the position is a vector class (Vector2D.java, Daniel Shiffman)

Code:

//import java.util.LinkedList;

public class MyDemo extends PApplet {

int fps = 30;
float LogicFrameLength = 1.0f/((float)fps);

Circ2D c;
//LinkedList queue;

void setup()
{
size(800,800); //Why doesn't this always work?
framerate(fps);
c = new Circ2D();
ellipseMode(CENTER);
c.Pos = new Vector2D(400,400);
c.r = 50;

}

void draw()
{
//fetch Input
//Update Simulation
//Render
DrawCirc(c);
}

public void DrawCirc(Circ2D c)
{
//Use processing's draw commands to draw the circle
//noStroke(); //?
//noFill(); //?
ellipse(c.Pos.x, c.Pos.y, c.r, c.r);
}

public void DrawLineSeg(LineSeg2D l)
{
//Use provessing's draw commands to draw the line
}

public void mousePressed()
{
//Put stuff in here for mouse click events
}

public void keyPressed()
{
//on keydown events
}

public void keyReleased()
{
//on keyup events
}
}


Page Index Toggle Pages: 1