Пример #1
0
int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes )
{
    int i;

    // Is joystick present?
    if( !_glfwJoy[ joy ].Present )
    {
        return 0;
    }

    // Update joystick state
    pollJoystickEvents();

    // Does the joystick support less axes than requested?
    if( _glfwJoy[ joy ].NumAxes < numaxes )
    {
        numaxes = _glfwJoy[ joy ].NumAxes;
    }

    // Copy axis positions from internal state
    for( i = 0; i < numaxes; ++ i )
    {
        pos[ i ] = _glfwJoy[ joy ].Axis[ i ];
    }

    return numaxes;
}
Пример #2
0
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
    pollJoystickEvents();

    *count = _glfw->linux_js.js[joy].buttonCount;
    return _glfw->linux_js.js[joy].buttons;
}
Пример #3
0
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
    pollJoystickEvents();

    *count = _glfw->linux_js.js[joy].axisCount;
    return _glfw->linux_js.js[joy].axes;
}
Пример #4
0
int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons,
    int numbuttons )
{
    int i;

    // Is joystick present?
    if( !_glfwJoy[ joy ].Present )
    {
        return 0;
    }

    // Update joystick state
    pollJoystickEvents();

    // Does the joystick support less buttons than requested?
    if( _glfwJoy[ joy ].NumButtons < numbuttons )
    {
        numbuttons = _glfwJoy[ joy ].NumButtons;
    }

    // Copy button states from internal state
    for( i = 0; i < numbuttons; ++ i )
    {
        buttons[ i ] = _glfwJoy[ joy ].Button[ i ];
    }

    return numbuttons;
}
Пример #5
0
const char* _glfwPlatformGetJoystickName(int joy)
{
    _GLFWjoystickLinux* js = _glfw.linux_js.js + joy;
    if (!pollJoystickEvents(js))
        return NULL;

    return js->name;
}
Пример #6
0
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
    _GLFWjoystickLinux* js = _glfw.linux_js.js + joy;
    if (!pollJoystickEvents(js))
        return NULL;

    *count = js->axisCount;
    return js->axes;
}
Пример #7
0
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
    _GLFWjoystickLinux* js = _glfw.linux_js.js + joy;
    if (!pollJoystickEvents(js))
        return NULL;

    *count = js->buttonCount;
    return js->buttons;
}
Пример #8
0
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
    pollJoystickEvents();

    if (!_glfw.x11.joystick[joy].present)
        return NULL;

    *count = _glfw.x11.joystick[joy].buttonCount;
    return _glfw.x11.joystick[joy].buttons;
}
Пример #9
0
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
    pollJoystickEvents();

    if (!_glfw.x11.joystick[joy].present)
        return NULL;

    *count = _glfw.x11.joystick[joy].axisCount;
    return _glfw.x11.joystick[joy].axes;
}
Пример #10
0
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numAxes)
{
    int i;

    pollJoystickEvents();

    if (!_glfwLibrary.X11.joystick[joy].present)
        return 0;

    if (_glfwLibrary.X11.joystick[joy].numAxes < numAxes)
        numAxes = _glfwLibrary.X11.joystick[joy].numAxes;

    for (i = 0;  i < numAxes;  i++)
        axes[i] = _glfwLibrary.X11.joystick[joy].axis[i];

    return numAxes;
}
Пример #11
0
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
                                    int numButtons)
{
    int i;

    pollJoystickEvents();

    if (!_glfwLibrary.X11.joystick[joy].present)
        return 0;

    if (_glfwLibrary.X11.joystick[joy].numButtons < numButtons)
        numButtons = _glfwLibrary.X11.joystick[joy].numButtons;

    for (i = 0;  i < numButtons;  i++)
        buttons[i] = _glfwLibrary.X11.joystick[joy].button[i];

    return numButtons;
}
Пример #12
0
int _glfwPlatformGetJoystickParam(int joy, int param)
{
    pollJoystickEvents();

    if (!_glfwLibrary.X11.joystick[joy].present)
        return 0;

    switch (param)
    {
        case GLFW_PRESENT:
            return GL_TRUE;

        case GLFW_AXES:
            return _glfwLibrary.X11.joystick[joy].numAxes;

        case GLFW_BUTTONS:
            return _glfwLibrary.X11.joystick[joy].numButtons;

        default:
            _glfwSetError(GLFW_INVALID_ENUM, NULL);
    }

    return 0;
}
Пример #13
0
const char* _glfwPlatformGetJoystickName(int joy)
{
    pollJoystickEvents();

    return _glfw->linux_js.js[joy].name;
}
Пример #14
0
int _glfwPlatformJoystickPresent(int joy)
{
    pollJoystickEvents();

    return _glfw.x11.joystick[joy].present;
}
Пример #15
0
int _glfwPlatformJoystickPresent(int joy)
{
    pollJoystickEvents();

    return _glfw->linux_js.js[joy].present;
}
Пример #16
0
const char* _glfwPlatformGetJoystickName(int joy)
{
    pollJoystickEvents();

    return _glfw.x11.joystick[joy].name;
}
Пример #17
0
int _glfwPlatformJoystickPresent(int joy)
{
    _GLFWjoystickLinux* js = _glfw.linux_js.js + joy;
    return pollJoystickEvents(js);
}