mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Renamed CURSOR_CAPTURED to CURSOR_DISABLED.
This commit is contained in:
parent
9264b5da0e
commit
6df692b61e
|
@ -320,7 +320,7 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|||
|
||||
if (action == GLFW_PRESS)
|
||||
{
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED);
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
locked = GL_TRUE;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -543,7 +543,7 @@ extern "C" {
|
|||
|
||||
#define GLFW_CURSOR_NORMAL 0x00040001
|
||||
#define GLFW_CURSOR_HIDDEN 0x00040002
|
||||
#define GLFW_CURSOR_CAPTURED 0x00040003
|
||||
#define GLFW_CURSOR_DISABLED 0x00040003
|
||||
|
||||
#define GLFW_GAMMA_RAMP_SIZE 256
|
||||
|
||||
|
@ -1704,8 +1704,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
|
|||
* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
|
||||
* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
|
||||
* area of the window.
|
||||
* - `GLFW_CURSOR_CAPTURED` makes the cursor invisible and unable to leave the
|
||||
* window but unconstrained in terms of position.
|
||||
* - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on
|
||||
* cursor movement.
|
||||
*
|
||||
* If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
|
||||
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
|
||||
|
@ -1773,9 +1773,9 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
|||
* This function returns the last reported position of the cursor to the
|
||||
* specified window.
|
||||
*
|
||||
* If the cursor mode of the specified window is `GLFW_CURSOR_CAPTURED` then
|
||||
* the cursor position is unbounded and limited only by the minimum and maximum
|
||||
* values of a `double`.
|
||||
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
||||
* position is unbounded and limited only by the minimum and maximum values of
|
||||
* a `double`.
|
||||
*
|
||||
* The coordinate can be converted to their integer equivalents with the
|
||||
* `floor` function. Casting directly to an integer type works for positive
|
||||
|
@ -1799,9 +1799,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
|||
* focused. If the window does not have focus when this function is called, it
|
||||
* fails silently.
|
||||
*
|
||||
* If the cursor mode of the specified window is `GLFW_CURSOR_CAPTURED` then
|
||||
* the cursor position is unbounded and limited only by the minimum and maximum
|
||||
* values of a `double`.
|
||||
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
||||
* position is unbounded and limited only by the minimum and maximum values of
|
||||
* a `double`.
|
||||
*
|
||||
* @param[in] window The desired window.
|
||||
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
||||
|
|
|
@ -116,7 +116,7 @@ static void centerCursor(_GLFWwindow *window)
|
|||
_glfwInputWindowSize(window, width, height);
|
||||
_glfwInputWindowDamage(window);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
centerCursor(window);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ static void centerCursor(_GLFWwindow *window)
|
|||
_glfwPlatformGetWindowPos(window, &x, &y);
|
||||
_glfwInputWindowPos(window, x, y);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
centerCursor(window);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void centerCursor(_GLFWwindow *window)
|
|||
{
|
||||
_glfwInputWindowFocus(window, GL_TRUE);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
centerCursor(window);
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||
|
||||
- (void)mouseMoved:(NSEvent *)event
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
_glfwInputCursorMotion(window, [event deltaX], [event deltaY]);
|
||||
else
|
||||
{
|
||||
|
@ -1020,7 +1020,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
||||
}
|
||||
|
||||
if (mode == GLFW_CURSOR_CAPTURED)
|
||||
if (mode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
CGAssociateMouseAndMouseCursorPosition(false);
|
||||
|
||||
|
|
12
src/input.c
12
src/input.c
|
@ -42,7 +42,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
|||
|
||||
if (newMode != GLFW_CURSOR_NORMAL &&
|
||||
newMode != GLFW_CURSOR_HIDDEN &&
|
||||
newMode != GLFW_CURSOR_CAPTURED)
|
||||
newMode != GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, NULL);
|
||||
return;
|
||||
|
@ -54,9 +54,9 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
|||
|
||||
if (window == _glfw.focusedWindow)
|
||||
{
|
||||
if (oldMode == GLFW_CURSOR_CAPTURED)
|
||||
if (oldMode == GLFW_CURSOR_DISABLED)
|
||||
_glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY);
|
||||
else if (newMode == GLFW_CURSOR_CAPTURED)
|
||||
else if (newMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
|
@ -179,7 +179,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
|||
|
||||
void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y)
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
if (x == 0.0 && y == 0.0)
|
||||
return;
|
||||
|
@ -333,8 +333,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
|||
window->cursorPosX = xpos;
|
||||
window->cursorPosY = ypos;
|
||||
|
||||
// Do not move physical cursor in locked cursor mode
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
// Do not move physical cursor if it is disabled
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
return;
|
||||
|
||||
// Update physical cursor position
|
||||
|
|
|
@ -412,7 +412,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
{
|
||||
// The window was focused
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
captureCursor(window);
|
||||
else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||
hideCursor(window);
|
||||
|
@ -579,7 +579,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
{
|
||||
double x, y;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
if (_glfw.focusedWindow != window)
|
||||
return 0;
|
||||
|
@ -638,7 +638,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
|
||||
case WM_SIZE:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
updateClipRect(window);
|
||||
|
||||
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
|
||||
|
@ -647,7 +647,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
|
||||
case WM_MOVE:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
updateClipRect(window);
|
||||
|
||||
_glfwInputWindowPos(window, LOWORD(lParam), HIWORD(lParam));
|
||||
|
@ -1071,7 +1071,7 @@ void _glfwPlatformPollEvents(void)
|
|||
}
|
||||
|
||||
// Did the cursor move in an focused window that has captured the cursor
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED &&
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
||||
!window->win32.cursorCentered)
|
||||
{
|
||||
int width, height;
|
||||
|
@ -1109,7 +1109,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||
case GLFW_CURSOR_HIDDEN:
|
||||
hideCursor(window);
|
||||
break;
|
||||
case GLFW_CURSOR_CAPTURED:
|
||||
case GLFW_CURSOR_DISABLED:
|
||||
captureCursor(window);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -626,7 +626,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
int x, y;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
if (_glfw.focusedWindow != window)
|
||||
break;
|
||||
|
@ -705,7 +705,7 @@ static void processEvent(XEvent *event)
|
|||
{
|
||||
_glfwInputWindowFocus(window, GL_TRUE);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
captureCursor(window);
|
||||
|
||||
break;
|
||||
|
@ -715,7 +715,7 @@ static void processEvent(XEvent *event)
|
|||
{
|
||||
_glfwInputWindowFocus(window, GL_FALSE);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
showCursor(window);
|
||||
|
||||
break;
|
||||
|
@ -788,7 +788,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
double x, y;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
if (_glfw.focusedWindow != window)
|
||||
break;
|
||||
|
@ -1092,7 +1092,7 @@ void _glfwPlatformPollEvents(void)
|
|||
window = _glfw.focusedWindow;
|
||||
if (window)
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
|
@ -1148,7 +1148,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|||
case GLFW_CURSOR_HIDDEN:
|
||||
hideCursor(window);
|
||||
break;
|
||||
case GLFW_CURSOR_CAPTURED:
|
||||
case GLFW_CURSOR_DISABLED:
|
||||
captureCursor(window);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static double cursor_y;
|
|||
|
||||
static void toggle_cursor(GLFWwindow* window)
|
||||
{
|
||||
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_CAPTURED)
|
||||
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
printf("Released cursor\n");
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
|
@ -49,7 +49,7 @@ static void toggle_cursor(GLFWwindow* window)
|
|||
else
|
||||
{
|
||||
printf("Captured cursor\n");
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED);
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user