@ -48,6 +48,16 @@
@ implementation GLFWWindowDelegate
@ implementation GLFWWindowDelegate
static void resetMouseCursor ( _GLFWwindow * window )
{
if ( window - > cursorMode == GLFW_CURSOR_CAPTURED )
{
int width , height ;
_glfwPlatformGetWindowSize ( window , & width , & height ) ;
_glfwPlatformSetCursorPos ( window , width / 2 , height / 2 ) ;
}
}
- ( id ) initWithGlfwWindow : ( _GLFWwindow * ) initWindow
- ( id ) initWithGlfwWindow : ( _GLFWwindow * ) initWindow
{
{
self = [ super init ] ;
self = [ super init ] ;
@ -70,6 +80,8 @@
int width , height ;
int width , height ;
_glfwPlatformGetWindowSize ( window , & width , & height ) ;
_glfwPlatformGetWindowSize ( window , & width , & height ) ;
_glfwInputWindowSize ( window , width , height ) ;
_glfwInputWindowSize ( window , width , height ) ;
resetMouseCursor ( window ) ;
}
}
- ( void ) windowDidMove : ( NSNotification * ) notification
- ( void ) windowDidMove : ( NSNotification * ) notification
@ -79,6 +91,8 @@
int x , y ;
int x , y ;
_glfwPlatformGetWindowPos ( window , & x , & y ) ;
_glfwPlatformGetWindowPos ( window , & x , & y ) ;
_glfwInputWindowPos ( window , x , y ) ;
_glfwInputWindowPos ( window , x , y ) ;
resetMouseCursor ( window ) ;
}
}
- ( void ) windowDidMiniaturize : ( NSNotification * ) notification
- ( void ) windowDidMiniaturize : ( NSNotification * ) notification
@ -94,6 +108,8 @@
- ( void ) windowDidBecomeKey : ( NSNotification * ) notification
- ( void ) windowDidBecomeKey : ( NSNotification * ) notification
{
{
_glfwInputWindowFocus ( window , GL_TRUE ) ;
_glfwInputWindowFocus ( window , GL_TRUE ) ;
resetMouseCursor ( window ) ;
}
}
- ( void ) windowDidResignKey : ( NSNotification * ) notification
- ( void ) windowDidResignKey : ( NSNotification * ) notification