Como apontar para uma função que é membro da classe - glfw setKeycallback
Estou escrevendo um aplicativo glfw, no qual agrupei a chamada de função em uma classe simples. Estou tendo problemas para definir o retorno de chamada principal. Minha classe é definida como:
class GAME
{
private:
bool running;
public:
GAME();
int execute();
void events(int, int);
int loop();
int render();
};
A função de execução é:
int GAME::execute()
{
glfwOpenWindow(640, 320, 8, 8, 8, 8, 0, 0, GLFW_WINDOW);
glfwSetWindowTitle("Viraj");
glfwSetKeyCallback(events);
running = true;
while(glfwGetWindowParam(GLFW_OPENED))
{
glfwPollEvents();
loop();
render();
}
return 0;
}
A compilação do código a seguir no Visual Studio 2010 fornece o erro:
error C3867: 'GAME::events': function call missing argument list; use '&GAME::events' to create a pointer to member
Using & GAME :: events fornece:
error C2664: 'glfwSetKeyCallback' : cannot convert parameter 1 from 'void (__thiscall GAME::* )(int,int)' to 'GLFWkeyfun' 1> There is no context in which this conversio,n is possible