Пример #1
0
GLFWAPI int glfwGetJoystickButtons(int joy,
                                   unsigned char* buttons,
                                   int numbuttons)
{
    int i;

    if (!_glfwInitialized)
    {
        _glfwSetError(GLFW_NOT_INITIALIZED, NULL);
        return 0;
    }

    if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
    {
        _glfwSetError(GLFW_INVALID_ENUM, NULL);
        return 0;
    }

    if (buttons == NULL || numbuttons < 0)
    {
        _glfwSetError(GLFW_INVALID_VALUE, NULL);
        return 0;
    }

    // Clear button states
    for (i = 0;  i < numbuttons;  i++)
        buttons[i] = GLFW_RELEASE;

    return _glfwPlatformGetJoystickButtons(joy, buttons, numbuttons);
}
Пример #2
0
GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
{
    *count = 0;

    _GLFW_REQUIRE_INIT_OR_RETURN(NULL);

    if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
    {
        _glfwInputError(GLFW_INVALID_ENUM, NULL);
        return NULL;
    }

    return _glfwPlatformGetJoystickButtons(joy, count);
}
Пример #3
0
GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count)
{
    assert(count != NULL);
    *count = 0;

    _GLFW_REQUIRE_INIT_OR_RETURN(NULL);

    if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
    {
        _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick %i", jid);
        return NULL;
    }

    return _glfwPlatformGetJoystickButtons(jid, count);
}
Пример #4
0
GLFWAPI int GLFWAPIENTRY glfwGetJoystickButtons( int joy,
                                                 unsigned char *buttons,
                                                 int numbuttons )
{
    int i;

    if( !_glfwInitialized )
    {
        return 0;
    }

    // Clear button states
    for( i = 0; i < numbuttons; i++ )
    {
        buttons[ i ] = GLFW_RELEASE;
    }

    return _glfwPlatformGetJoystickButtons( joy, buttons, numbuttons );
}