Example #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;
}
Example #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;
}
Example #3
0
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
    pollJoystickEvents();

    *count = _glfw->linux_js.js[joy].axisCount;
    return _glfw->linux_js.js[joy].axes;
}
Example #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;
}
Example #5
0
const char* _glfwPlatformGetJoystickName(int joy)
{
    _GLFWjoystickLinux* js = _glfw.linux_js.js + joy;
    if (!pollJoystickEvents(js))
        return NULL;

    return js->name;
}
Example #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;
}
Example #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;
}
Example #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;
}
Example #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;
}
Example #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;
}
Example #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;
}
Example #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;
}
Example #13
0
const char* _glfwPlatformGetJoystickName(int joy)
{
    pollJoystickEvents();

    return _glfw->linux_js.js[joy].name;
}
Example #14
0
int _glfwPlatformJoystickPresent(int joy)
{
    pollJoystickEvents();

    return _glfw.x11.joystick[joy].present;
}
Example #15
0
int _glfwPlatformJoystickPresent(int joy)
{
    pollJoystickEvents();

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

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