Menu

Rather noob-ish question, hope noone minds

Using GLFW
2004-06-30
2004-07-07
  • Nobody/Anonymous

    Would someone mind showing an actual example about how to use the GFLWSetMousePosCallback? The example in the User's Guide and the Reference aren't helping me much, and I have a feeling once I see actual code I'll understand. Thanks!

     
    • Marcus Geelnard

      Marcus Geelnard - 2004-07-07

      void GLFWCALL mouseposfun( int x, int y )
      {
        printf("Mouse pos = %d,%d\n", x, y);
      }

      int main(void)
      {
        glfwInit();
        glfwOpenWindow(100,100,8,8,8,0,0,0,GLFW_WINDOW);
        glfwSetMousePosCallback(mouseposfun);
        do
        {
          glfwPollEvents();  // <- this is where mouseposfun is called
        }
        while( !glfwGetKey(GLFW_KEY_ESC) );
        glfwTerminate();
      }