lundi 30 mars 2015

glfwSetCursorPosCallback to function in another class


Vote count:

0




I'm really stuck:


I have the mainWindow and in the main game loop I do:



// poll for input
glfwPollEvents();

this->controls->handleInput(window, world->getPlayer());
glfwSetCursorPosCallback(window, controls->handleMouse);


What I want to do is to have one class responsible for the controls and to have this class also handle the mouse.


I always get:



'Controls::handleMouse': function call missing argument list; use '&Controls::handleMouse' to create a pointer to member


Now when I try this I get:



'GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow *,GLFWcursorposfun)' : cannot convert argument 2 from 'void (__thiscall Controls::* )(GLFWwindow *,double,double)' to 'GLFWcursorposfun'


Not sure what I'm doing wrong here, as GLFWcursorposfun is just a typedef with a GLFWwindow and two doubles.


As the function is in another class I tried creating a prototype for it, like:



class Controls {
void handleInput(GLFWwindow *window, object *gameObject);
void handleMouse(GLFWwindow *window, double mouseXPos, double mouseYPos);
};


but to no avail.



asked 1 min ago







glfwSetCursorPosCallback to function in another class

Aucun commentaire:

Enregistrer un commentaire