This works: (main):
glfwSetCharCallback(window, Console_Input);
(global):
void Console_Input(GLFWwindow* window, unsigned int letter_i){
}
If I try to put it inside class: (main):
Input_text Text_Input(&Text_Input_bar, &GLOBALS);
glfwSetCharCallback(window, Text_Input.Console_Input);
(global):
class Input_text{
...
void Console_Input(GLFWwindow* window, unsigned int letter_i){
}
void Update(){
if(active == 1){
MBar->Re_set_bar_width(str);
MBar->update_bar();
}
}
};
It doesnt work. I get error: cannot convert 'Input_text::Console_Input' from type 'void (Input_text::)(GLFWwindow*, unsigned int)' to type 'GLFWcharfun {aka void ()(GLFWwindow, unsigned int)}' I dont want to write functionality inside callback function. I need self-managing class. Is there a way to set glfwSetCharCallback to the function inside a class?