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 Bugs › class wierdness
Page Index Toggle Pages: 1
class wierdness (Read 1331 times)
class wierdness
May 16th, 2005, 9:32am
 
There's some wierd issues i've been experiencing when trying to make a class.

The program will run however when close it and try to return to the editor, the editor freezes up.
I've noticed the java icon appears when running my code and sometimes if i'm really patient and play with the window (try to highlight stuff or go into full screen using a command prompt window) it will sort of render the editor properly with limited functionality.

When i do close the editor it does give me a blank "do i wish to save" prompt.

Re: class wierdness
Reply #1 - May 16th, 2005, 4:56pm
 
can you give a minimal code-example that triggers this behaviour?

F
Re: class wierdness
Reply #2 - May 17th, 2005, 12:58am
 
Sure, i simply copied the code from the reference library.

I've with it a bit more and noticed that when i run a sketch, the screen jerks around a bit and not only does the processing editor break, so does the java control panel. i'm running java 1.5.0_02 btw.. might that be causing it?
     

// Declare and contruct two objects (h1, h2) from the class HLine
HLine h1 = new HLine(20, 2.0);
HLine h2 = new HLine(50, 2.5);

void setup()
{
 size(200, 200);
 framerate(30);
}

void draw() {
 background(204);
 h1.update();
 h2.update();  
}

class HLine {
 float ypos, speed;
 HLine (float y, float s) {  
   ypos = y;
   speed = s;
 }
 void update() {
   ypos += speed;
   if (ypos > width) {
     ypos = 0;
   }
   line(0, ypos, width, ypos);
 }
}
Re: class wierdness
Reply #3 - May 17th, 2005, 1:15am
 
which version of windows are you on? which version of processing are you using?

your code works fine for me (*), though i have a small improvement:
Code:

HLine h1;  
HLine h2;  
 
void setup()  
{  
 size(200, 200);
h1 = new HLine(20, 2.0);
h2 = new HLine(50, 2.5);  
 framerate(30);  
}

...


you should try to get used to initializing objects in setup(), not outside any functions. that is because it might happen that they are not yet initialized when code elsewhere is already trying to use them ...

( where exactly is the code from? )

F


<<update>>
(*) i'm on os-x, java 1.4.2, procssing .9
Re: class wierdness
Reply #4 - May 17th, 2005, 3:53am
 
using xp sp2 and latest processing 0090 .

that code was simple cut and pasted from
http://processing.org/reference/class.html

Re: class wierdness
Reply #5 - May 17th, 2005, 4:32am
 
are you using the standard or "non-java" version? if you're using the non-java version, could you try it with the standard version? it may be a problem with java 1.5, which is not supported.
Re: class wierdness
Reply #6 - May 17th, 2005, 5:40am
 
I'm using the standard java version downloaded from sun.

I'll go and download a 1.4.x version of java and test that out.
Re: class wierdness
Reply #7 - May 25th, 2005, 8:26am
 
I found what was causing it.

I'm using an nvidia geforce fx5600 and had forced the video card to perform 2x antialiasing on all apps that use the cards' specifics (available via the display properties menu)

turning it off stopped all the issues...

obscure Smiley

Page Index Toggle Pages: 1