FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   color declaration before setup()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: color declaration before setup()  (Read 204 times)
heliodrop
Guest
Email
color declaration before setup()
« on: Jul 17th, 2003, 4:47pm »

Hello. I have a little question.
 
I dont understand why this code works:
 
// Color Test : OK
void setup() {
  size(200, 200);
}
void loop() {
  color black = color(0, 0, 0);
  color white = color(255, 255, 255);
  setPixel(10, 10, black);
  setPixel(20, 20, white);
}
// End
 
 
and why this one doesn't:
 
// Color Test : NullPointerException
color black = color(0, 0, 0);
color white = color(255, 255, 255);
void setup() {
  size(200, 200);
}
void loop() {
  setPixel(10, 10, black);
  setPixel(20, 20, white);
}
// End
 
 
I have a NullPointerException (when I run the 2nd sketch), and I don't understand why. Because all other type of variables (int, float, etc...) can be defined before the setup() function.
(the revision number 0056
i'm using win9
 
Does anyone can explain me that ?
thanks!
 
 
heliodrop
Guest
Email
Re: color declaration before setup()
« Reply #1 on: Jul 17th, 2003, 4:50pm »

i'm really sorry,
this is a bug report and not a bug fixes
 
Pages: 1 

« Previous topic | Next topic »