Hi,
I'm beginning in processing, and I need to do a basic slider
(those of libraries like ControlP5 are too complicated for me at the moment, and I would to modify styles)
So I started to make one, and I have already problems...
It say me that there is an NullPointer exception
There my code :
Code:
Slider slider1;
void setup(){
/////////////////////////////////////
size (500,500);
background(120);
/////////////////////////////////////
Slider slider1 = new Slider(20,20,100,20);
}
void draw(){
slider1.dessiner();
}
class Slider{
int sPosX, sPosY;
int sLargeur, sHauteur;
//int sMin, sMax;
//int sInitial;
//int nom;
//int valeur;
Slider(int isPosX, int isPosY, int isLargeur, int isHauteur){
sPosX = isPosX;
sPosY = isPosY;
sLargeur = isLargeur;
sHauteur = isHauteur;
}
void dessiner(){
noStroke();
fill(150);
rect(sPosX,sPosY,sLargeur,sHauteur);
fill(80);
rect(sPosX,sPosY,sLargeur,sHauteur);
}
/*void bouger(){
if(mousePressed){
rect(sPosX,sPosY,mouseX-sPosX,sHauteur);
}
}*/
}
if someone can have a look, thank you !