mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Renamed internal cursor position in preparation of new API.
This commit is contained in:
parent
851f510d4b
commit
2660b27cf3
@ -688,8 +688,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
NSPoint point = [[NSCursor currentCursor] hotSpot];
|
||||
window->mousePosX = point.x;
|
||||
window->mousePosY = point.y;
|
||||
window->cursorPosX = point.x;
|
||||
window->cursorPosY = point.y;
|
||||
|
||||
window->windowNoResize = wndconfig->windowNoResize;
|
||||
|
||||
|
30
src/input.c
30
src/input.c
@ -125,20 +125,22 @@ void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y)
|
||||
if (!x && !y)
|
||||
return;
|
||||
|
||||
window->mousePosX += x;
|
||||
window->mousePosY += y;
|
||||
window->cursorPosX += x;
|
||||
window->cursorPosY += y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->mousePosX == x && window->mousePosY == y)
|
||||
if (window->cursorPosX == x && window->cursorPosY == y)
|
||||
return;
|
||||
|
||||
window->mousePosX = x;
|
||||
window->mousePosY = y;
|
||||
window->cursorPosX = x;
|
||||
window->cursorPosY = y;
|
||||
}
|
||||
|
||||
if (_glfwLibrary.mousePosCallback)
|
||||
_glfwLibrary.mousePosCallback(window, window->mousePosX, window->mousePosY);
|
||||
_glfwLibrary.mousePosCallback(window,
|
||||
window->cursorPosX,
|
||||
window->cursorPosY);
|
||||
}
|
||||
|
||||
|
||||
@ -229,10 +231,10 @@ GLFWAPI void glfwGetMousePos(GLFWwindow handle, int* xpos, int* ypos)
|
||||
|
||||
// Return mouse position
|
||||
if (xpos != NULL)
|
||||
*xpos = window->mousePosX;
|
||||
*xpos = window->cursorPosX;
|
||||
|
||||
if (ypos != NULL)
|
||||
*ypos = window->mousePosY;
|
||||
*ypos = window->cursorPosY;
|
||||
}
|
||||
|
||||
|
||||
@ -258,12 +260,12 @@ GLFWAPI void glfwSetMousePos(GLFWwindow handle, int xpos, int ypos)
|
||||
}
|
||||
|
||||
// Don't do anything if the mouse position did not change
|
||||
if (xpos == window->mousePosX && ypos == window->mousePosY)
|
||||
if (xpos == window->cursorPosX && ypos == window->cursorPosY)
|
||||
return;
|
||||
|
||||
// Set GLFW mouse position
|
||||
window->mousePosX = xpos;
|
||||
window->mousePosY = ypos;
|
||||
window->cursorPosX = xpos;
|
||||
window->cursorPosY = ypos;
|
||||
|
||||
// Do not move physical cursor in locked cursor mode
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
@ -331,8 +333,8 @@ GLFWAPI void glfwSetCursorMode(GLFWwindow handle, int mode)
|
||||
{
|
||||
_glfwPlatformSetMouseCursorPos(window, centerPosX, centerPosY);
|
||||
_glfwInputCursorMotion(window,
|
||||
centerPosX - window->mousePosX,
|
||||
centerPosY - window->mousePosY);
|
||||
centerPosX - window->cursorPosX,
|
||||
centerPosY - window->cursorPosY);
|
||||
}
|
||||
|
||||
_glfwPlatformSetCursorMode(window, mode);
|
||||
@ -411,7 +413,7 @@ GLFWAPI void glfwSetMousePosCallback(GLFWmouseposfun cbfun)
|
||||
_GLFWwindow* window;
|
||||
|
||||
for (window = _glfwLibrary.windowListHead; window; window = window->next)
|
||||
cbfun(window, window->mousePosX, window->mousePosY);
|
||||
cbfun(window, window->cursorPosX, window->cursorPosY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ struct _GLFWwindow
|
||||
GLboolean stickyMouseButtons;
|
||||
GLboolean keyRepeat;
|
||||
GLboolean sysKeysDisabled; // system keys disabled flag
|
||||
int mousePosX, mousePosY;
|
||||
int cursorPosX, cursorPosY;
|
||||
int cursorMode;
|
||||
int scrollX, scrollY;
|
||||
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
|
@ -1371,8 +1371,8 @@ static int createWindow(_GLFWwindow* window,
|
||||
// Initialize mouse position data
|
||||
GetCursorPos(&pos);
|
||||
ScreenToClient(window->Win32.handle, &pos);
|
||||
window->Win32.oldMouseX = window->mousePosX = pos.x;
|
||||
window->Win32.oldMouseY = window->mousePosY = pos.y;
|
||||
window->Win32.oldMouseX = window->cursorPosX = pos.x;
|
||||
window->Win32.oldMouseY = window->cursorPosY = pos.y;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
@ -1786,8 +1786,8 @@ void _glfwPlatformPollEvents(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
//window->Win32.oldMouseX = window->mousePosX;
|
||||
//window->Win32.oldMouseY = window->mousePosY;
|
||||
//window->Win32.oldMouseX = window->cursorPosX;
|
||||
//window->Win32.oldMouseY = window->cursorPosY;
|
||||
}
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
|
@ -1457,8 +1457,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
||||
|
||||
// TODO: Probably check for some corner cases here.
|
||||
|
||||
window->mousePosX = windowX;
|
||||
window->mousePosY = windowY;
|
||||
window->cursorPosX = windowX;
|
||||
window->cursorPosY = windowY;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user