mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Initial implementation of cursor mode on Cocoa.
This commit is contained in:
parent
3b733b91bb
commit
285ab537f7
@ -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…
Reference in New Issue
Block a user