create my own class
in
Programming Questions
•
9 months ago
Hello everybody,
I try to create my own class in processing.
Please fiond my code
If I launch this code in porcessing 2.0b7 in mac os x, I see a error message telling me that :
"The constructor is undefined. "
Could someone help my. For me my code is ok, the name of the class and the constructor is the same name. I pass four float to my constructor and my second constructor needs four float. I don't understand why I have this error. is it a bug of the beta 7 version ?
thanks in advance for your help.
Julien
I try to create my own class in processing.
Please fiond my code
- float toolsBarLargeur;
float toolsBarHauteur;
float toolsBarX=0;
float toolsBarY;
float dessinLargeur;
float dessinHauteur;
float dessinX;
float dessinY;
float cercleMiddleX;
float cercleMiddleY;
float cercleWidth;
float cercleHeigth;
int backtools;
ToolsBar tools;
void setup()
{
size(displayWidth, displayHeight);
// on dessin les parties de l'ecran
noStroke();
fill(150);
ellipseMode(CENTER); // Set ellipseMode to CENTER
toolsBarLargeur=width;
toolsBarHauteur=height*0.1;
toolsBarY=height*0.9;
dessinLargeur=width;
dessinHauteur=height*0.9;
dessinX=width;
dessinY=height*0.9;
cercleMiddleX = dessinX/2;
cercleMiddleY = dessinY/2;
backtools=150;
tools = new ToolsBar(toolsBarX,toolsBarY,dessinLargeur,dessinHauteur);
// tools = new ToolsBar();
// println(tools.getX);
}
void draw()
{
tools.display();
// println(tools.getX);
//ici c'est la partie ou l'on dessin
fill(40);
rect(dessinX,toolsBarY,dessinLargeur,dessinHauteur);
stroke(0);
noFill();
if(dessinLargeur<dessinHauteur)
{
cercleWidth=dessinLargeur-10;
cercleHeigth=dessinLargeur-10;
}
else
{
cercleWidth=dessinHauteur-10;
cercleHeigth=dessinHauteur-10;
}
ellipse(cercleMiddleX, cercleMiddleY, cercleWidth,cercleHeigth); // Draw gray ellipse using CENTER mode
}
boolean sketchFullScreen() {
return true;
}
class ToolsBar
{
float toolsLargeur;
float toolsHauteur;
float toolsX;
float toolsY;
int toolsBackground;
void ToolsBar()
{
toolsLargeur=0;
toolsHauteur=0;
toolsX=0;
toolsY=0;
toolsBackground=0;
}
void ToolsBar(float startX, float startY, float myWidth, float myHeigth, int toolsBarBack)
{
toolsLargeur=myWidth;
toolsHauteur=myHeigth;
toolsX=startX;
toolsY=startY;
toolsBackground=toolsBarBack;
}
void ToolsBar(float startX, float startY, float myWidth, float myHeigth)
{
toolsLargeur=myWidth;
toolsHauteur=myHeigth;
toolsX=startX;
toolsY=startY;
toolsBackground=2;
}
void display()
{
fill(toolsBackground);
rect(toolsX,toolsY,toolsLargeur,toolsHauteur);
}
float getX()
{
return toolsX;
}
}
If I launch this code in porcessing 2.0b7 in mac os x, I see a error message telling me that :
"The constructor is undefined. "
Could someone help my. For me my code is ok, the name of the class and the constructor is the same name. I pass four float to my constructor and my second constructor needs four float. I don't understand why I have this error. is it a bug of the beta 7 version ?
thanks in advance for your help.
Julien
1