I would like someone to help me or give me an explanation regarding a problem presented with the glutMouseFunc () function, I have created a class called Button
class Button{
private:
char *texto;
int iniX;
int iniY;
int tamX;
int tamY;
void (*accion)();
public:
Button(char *, int, int);
void dibujar();
void onMouseClick(int, int, int, int);
void mouseClickLeft(void());
};
What happens is that when I implement the functions mouseClickLeft () and onMouseClick () I see an error.
void Button::mouseClickLeft(void func())
{
accion = func;
glutMouseFunc(onMouseClick);
}
void Button::onMouseClick(int button, int state, int x, int y)
{
if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
{
if((x>iniX && x<(iniX+tamX))&&(y<iniY && y>(iniY-tamY)))
{
accion;
}
}
}
wanting to pass the onMouseClick function to the glutMouseFun () function, tells me there is a conversion error. Someone can guide me to a possible solution, since I would like to generalize the function and so when creating an instance of objects, I can call the mouseClickLeft () function and do all the work.