Initial implementation of cursor mode on Cocoa.

This commit is contained in:
Camilla Berglund 2011-09-06 17:38:00 +02:00
parent 3b733b91bb
commit 285ab537f7

View File

@ -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;
}
}