Whats wrong in this class definition???
in
Programming Questions
•
6 months ago
Hi to all!!.......I want to change the value of rgb color contained in fill instruction but the class function return me an error during the execution (NullPointerException).....I'm a newby.....
.....where is the error???
void setup()
{
size(320, 240);
smooth();
noStroke();
frameRate(0.5);
}
void draw()
{
background(0);
fill (255,25,70);
rect (20,20,30,30);
c.colore(255,25,70);
rect (40,40,30,30);
}
class canali {
int rosso;
int verde;
int blu;
canali(int r,int v,int b)
{
rosso = r;
verde = v;
blu = b;
}
void colore(int rrosso, int vverde, int bblu)
{
if (rrosso > 250){
rosso=0;
fill(rosso,verde,blu);
}
}
}
Thanks!!
1