glfwSetCursorPosCallback to function in another class

后端 未结 3 2075
陌清茗
陌清茗 2020-12-12 04:10

I\'m really stuck:

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

// poll for input
glfwPollEvents();

this->controls->handleInput(windo         


        
3条回答
  •  伪装坚强ぢ
    2020-12-12 04:45

    My solution: Do not use the callback-setter. Instead I do the following:

    glfwPollEvents();
    
    this->controls->handleInput(window, mainObj);
    this->controls->handleMouse(window, mainObj);
    

    And within handleMouse I do:

    GLdouble xPos, yPos;
    glfwGetCursorPos(window, &xPos, &yPos);
    

提交回复
热议问题