Пример #1
0
static void enableMouseCursor( void )
{
    int centerPosX, centerPosY;

    if( !_glfwWin.opened || !_glfwWin.mouseLock )
    {
        return;
    }

    // Show mouse cursor
    _glfwPlatformShowMouseCursor();

    centerPosX = _glfwWin.width / 2;
    centerPosY = _glfwWin.height / 2;

    if( centerPosX != _glfwInput.MousePosX || centerPosY != _glfwInput.MousePosY )
    {
        _glfwPlatformSetMouseCursorPos( centerPosX, centerPosY );

        _glfwInput.MousePosX = centerPosX;
        _glfwInput.MousePosY = centerPosY;

        if( _glfwWin.mousePosCallback )
        {
            _glfwWin.mousePosCallback( _glfwInput.MousePosX,
                                       _glfwInput.MousePosY );
        }
    }

    // From now on the mouse is unlocked
    _glfwWin.mouseLock = GL_FALSE;
}
Пример #2
0
void _glfwPlatformCloseWindow( void )
{
    // Restore mouse pointer (if hidden)
    _glfwPlatformShowMouseCursor();

    // Destroy OpenGL context
    if( _glfwWin.Context )
    {
#ifdef _GLFW_STORMMESA
        AmigaMesaDestroyContext( _glfwWin.Context );
#endif
        _glfwWin.Context = NULL;
    }

    // Close window
    if( _glfwWin.Window )
    {
        CloseWindow( _glfwWin.Window );
        _glfwWin.Window = NULL;
    }

    // Close screen
    if( _glfwWin.Fullscreen && _glfwWin.Screen )
    {
        CloseScreen( _glfwWin.Screen );
    }
    _glfwWin.Screen = NULL;

    // Close input device I/O request
    if( _glfwWin.InputIO )
    {
        CloseDevice( (struct IORequest *) _glfwWin.InputIO );
        DeleteExtIO( (struct IORequest *) _glfwWin.InputIO );
        _glfwWin.InputIO = NULL;
    }

    // Close input device message port
    if( _glfwWin.InputMP )
    {
        DeletePort( _glfwWin.InputMP );
        _glfwWin.InputMP = NULL;
    }

}
Пример #3
0
static void enableMouseCursor( void )
{
    int centerPosX, centerPosY;

    if( !_glfwWin.opened || !_glfwWin.mouseLock )
    {
        return;
    }

    // Show mouse cursor
    _glfwPlatformShowMouseCursor();

    centerPosX = _glfwWin.width / 2;
    centerPosY = _glfwWin.height / 2;

    if( centerPosX != _glfwInput.MousePosX || centerPosY != _glfwInput.MousePosY )
    {
        _glfwPlatformSetMouseCursorPos( centerPosX, centerPosY );

        _glfwInput.MousePosX = centerPosX;
        _glfwInput.MousePosY = centerPosY;

        if( _glfwWin.mousePosCallback )
        {
#ifdef MMDAGENT
            _glfwWin.mousePosCallback( _glfwInput.MousePosX,
                                       _glfwInput.MousePosY,
                                       ( _glfwInput.Key[GLFW_KEY_LSHIFT] == GLFW_PRESS || _glfwInput.Key[GLFW_KEY_RSHIFT] == GLFW_PRESS ) ? GLFW_PRESS : GLFW_RELEASE,
                                       ( _glfwInput.Key[GLFW_KEY_LCTRL] == GLFW_PRESS || _glfwInput.Key[GLFW_KEY_RCTRL] == GLFW_PRESS ) ? GLFW_PRESS : GLFW_RELEASE );
#else
            _glfwWin.mousePosCallback( _glfwInput.MousePosX,
                                       _glfwInput.MousePosY );
#endif /* MMDAGENT */
        }
    }

    // From now on the mouse is unlocked
    _glfwWin.mouseLock = GL_FALSE;
}