mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21: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);
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
NSPoint point = [[NSCursor currentCursor] hotSpot];
|
NSPoint point = [[NSCursor currentCursor] hotSpot];
|
||||||
window->mousePosX = point.x;
|
window->cursorPosX = point.x;
|
||||||
window->mousePosY = point.y;
|
window->cursorPosY = point.y;
|
||||||
|
|
||||||
window->windowNoResize = wndconfig->windowNoResize;
|
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)
|
if (!x && !y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window->mousePosX += x;
|
window->cursorPosX += x;
|
||||||
window->mousePosY += y;
|
window->cursorPosY += y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (window->mousePosX == x && window->mousePosY == y)
|
if (window->cursorPosX == x && window->cursorPosY == y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window->mousePosX = x;
|
window->cursorPosX = x;
|
||||||
window->mousePosY = y;
|
window->cursorPosY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfwLibrary.mousePosCallback)
|
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
|
// Return mouse position
|
||||||
if (xpos != NULL)
|
if (xpos != NULL)
|
||||||
*xpos = window->mousePosX;
|
*xpos = window->cursorPosX;
|
||||||
|
|
||||||
if (ypos != NULL)
|
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
|
// 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;
|
return;
|
||||||
|
|
||||||
// Set GLFW mouse position
|
// Set GLFW mouse position
|
||||||
window->mousePosX = xpos;
|
window->cursorPosX = xpos;
|
||||||
window->mousePosY = ypos;
|
window->cursorPosY = ypos;
|
||||||
|
|
||||||
// Do not move physical cursor in locked cursor mode
|
// Do not move physical cursor in locked cursor mode
|
||||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||||
@ -331,8 +333,8 @@ GLFWAPI void glfwSetCursorMode(GLFWwindow handle, int mode)
|
|||||||
{
|
{
|
||||||
_glfwPlatformSetMouseCursorPos(window, centerPosX, centerPosY);
|
_glfwPlatformSetMouseCursorPos(window, centerPosX, centerPosY);
|
||||||
_glfwInputCursorMotion(window,
|
_glfwInputCursorMotion(window,
|
||||||
centerPosX - window->mousePosX,
|
centerPosX - window->cursorPosX,
|
||||||
centerPosY - window->mousePosY);
|
centerPosY - window->cursorPosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformSetCursorMode(window, mode);
|
_glfwPlatformSetCursorMode(window, mode);
|
||||||
@ -411,7 +413,7 @@ GLFWAPI void glfwSetMousePosCallback(GLFWmouseposfun cbfun)
|
|||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
for (window = _glfwLibrary.windowListHead; window; window = window->next)
|
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 stickyMouseButtons;
|
||||||
GLboolean keyRepeat;
|
GLboolean keyRepeat;
|
||||||
GLboolean sysKeysDisabled; // system keys disabled flag
|
GLboolean sysKeysDisabled; // system keys disabled flag
|
||||||
int mousePosX, mousePosY;
|
int cursorPosX, cursorPosY;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
int scrollX, scrollY;
|
int scrollX, scrollY;
|
||||||
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
||||||
|
@ -1371,8 +1371,8 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
// Initialize mouse position data
|
// Initialize mouse position data
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
ScreenToClient(window->Win32.handle, &pos);
|
ScreenToClient(window->Win32.handle, &pos);
|
||||||
window->Win32.oldMouseX = window->mousePosX = pos.x;
|
window->Win32.oldMouseX = window->cursorPosX = pos.x;
|
||||||
window->Win32.oldMouseY = window->mousePosY = pos.y;
|
window->Win32.oldMouseY = window->cursorPosY = pos.y;
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
@ -1786,8 +1786,8 @@ void _glfwPlatformPollEvents(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//window->Win32.oldMouseX = window->mousePosX;
|
//window->Win32.oldMouseX = window->cursorPosX;
|
||||||
//window->Win32.oldMouseY = window->mousePosY;
|
//window->Win32.oldMouseY = window->cursorPosY;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
|
@ -1457,8 +1457,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
// TODO: Probably check for some corner cases here.
|
// TODO: Probably check for some corner cases here.
|
||||||
|
|
||||||
window->mousePosX = windowX;
|
window->cursorPosX = windowX;
|
||||||
window->mousePosY = windowY;
|
window->cursorPosY = windowY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user