mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 21:37:27 +00:00
Add mouse position to mouse button callback
Adds the current mouse position as parameters to the mouse button callback. This is to aid in handling mouse button events properly. Resolves: #752
This commit is contained in:
parent
6ed5294223
commit
b6efafdf6e
@ -1684,6 +1684,10 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo
|
|||||||
* may add more actions.
|
* may add more actions.
|
||||||
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
|
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
|
||||||
* held down.
|
* held down.
|
||||||
|
* @param[in] xpos The x-coordinate of the cursor, relative to the left edge of
|
||||||
|
* the content area.
|
||||||
|
* @param[in] ypos The y-coordinate of the cursor, relative to the top edge of
|
||||||
|
* the content area.
|
||||||
*
|
*
|
||||||
* @sa @ref input_mouse_button
|
* @sa @ref input_mouse_button
|
||||||
* @sa @ref glfwSetMouseButtonCallback
|
* @sa @ref glfwSetMouseButtonCallback
|
||||||
@ -1693,7 +1697,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo
|
|||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
|
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods, double xpos, double ypos);
|
||||||
|
|
||||||
/*! @brief The function pointer type for cursor position callbacks.
|
/*! @brief The function pointer type for cursor position callbacks.
|
||||||
*
|
*
|
||||||
|
@ -336,7 +336,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
|||||||
window->mouseButtons[button] = (char) action;
|
window->mouseButtons[button] = (char) action;
|
||||||
|
|
||||||
if (window->callbacks.mouseButton)
|
if (window->callbacks.mouseButton)
|
||||||
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
|
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods, window->virtualCursorPosX, window->virtualCursorPosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notifies shared code of a cursor motion event
|
// Notifies shared code of a cursor motion event
|
||||||
|
Loading…
Reference in New Issue
Block a user