title: Save position of mouse GLFW
body: <p>I have my 2 glfwSet functions:</p>
  
  <pre><code>glfwSetCursorPosCallback(window, cursor_pos_callback);
  glfwSetMouseButtonCallback(window, mouseButtonCallback);
  </code></pre>
  
  <p>cursor_pos_callback functions:</p>
  
  <pre><code>static void cursor_pos_callback(GLFWwindow* window, double xpos, double ypos) {
  
      if (mouseButtonLeftDown) {
        cout &lt;&lt; "y pos: " &lt;&lt; ypos;
        cout &lt;&lt; "x pos: " &lt;&lt; xpos &lt;&lt; endl;
     }
  }
  </code></pre>
  
  <p>mouseButtonCallback function:</p>
  
  <pre><code> void mouseButtonCallback(GLFWwindow* _window, int button, int action, int mods)
   {
      switch (button)
      {
         case GLFW_MOUSE_BUTTON_LEFT:
         if (action == GLFW_PRESS)
        {
            cout &lt;&lt; "Mouse left input working" &lt;&lt; endl; //testing
            mouseButtonLeftDown = true;
  
         }
        else if (action == GLFW_RELEASE)
       {
           mouseButtonLeftDown = false;
        }
     }
   }
  </code></pre>
  
  <p>I'm getting my x and y output only after I have clicked and moved my cursor.</p>
  
  <p>The desired behavior that I'm trying to accomplish is to just click on my screen an save  the position of my cursor. Am I going about it the wrong way?</p>