Initial implementation of cursor mode on Cocoa.

master
Camilla Berglund ago%!(EXTRA string=14 years)
parent 3b733b91bb
commit 285ab537f7
  1. 41
      src/cocoa_window.m

@ -923,26 +923,6 @@ void _glfwPlatformWaitEvents( void )
_glfwPlatformPollEvents();
}
//========================================================================
// Hide mouse cursor (lock it)
//========================================================================
void _glfwPlatformHideMouseCursor(_GLFWwindow* window)
{
[NSCursor hide];
CGAssociateMouseAndMouseCursorPosition(false);
}
//========================================================================
// Show mouse cursor (unlock it)
//========================================================================
void _glfwPlatformShowMouseCursor(_GLFWwindow* window)
{
[NSCursor unhide];
CGAssociateMouseAndMouseCursorPosition(true);
}
//========================================================================
// Set physical mouse cursor position
//========================================================================
@ -975,3 +955,24 @@ void _glfwPlatformSetMouseCursorPos(_GLFWwindow* window, int x, int y)
CGDisplayMoveCursorToPoint(CGMainDisplayID(), targetPoint);
}
//========================================================================
// Set physical mouse cursor mode
//========================================================================
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
{
switch (mode)
{
case GLFW_CURSOR_NORMAL:
[NSCursor unhide];
CGAssociateMouseAndMouseCursorPosition(true);
break;
case GLFW_CURSOR_HIDDEN:
break;
case GLFW_CURSOR_CAPTURED:
[NSCursor hide];
CGAssociateMouseAndMouseCursorPosition(false);
break;
}
}

Loading…
Cancel
Save