void MxGamePadDX::processSticks( const DIJOYSTATE2& devState, const double deltaSeconds )
{
    float x, y;

    // Left stick: Move.
    // Normalize values to range -1.0 to 1.0.
    // These are units to move in world coordinates per event or per frame.
    x = normalizeAxisValue( devState.lX );
    y = normalizeAxisValue( devState.lY );
    setLeftStick( x, y, deltaSeconds );

    // Right stick: Rotate.
    // Base class angle values are in degrees. By calling
    // normalizeAxisValue, we pass in -1 to 1 degrees.
    // Compensate for rotation as well:
    //  x value around up vector, positive values counterclockwise
    //  y value around right/cross vector, positive values counterclockwise
    //    NOTE .lZ is positive when pulled back. This is the opposite of
    //    the left gamepad stick.
    x = -normalizeAxisValue( devState.lRz );
    y = normalizeAxisValue( devState.lZ );
    setRightStick( x, y, deltaSeconds );
}
void GamepadDeviceLinux::updateForEvent(struct js_event event)
{
    if (!(event.type & JS_EVENT_AXIS || event.type & JS_EVENT_BUTTON))
        return;

    // Mark the device as connected only if it is not yet connected, the event is not an initialization
    // and the value is not 0 (indicating a genuine interaction with the device).
    if (!m_connected && !(event.type & JS_EVENT_INIT) && event.value)
        m_connected = true;

    if (event.type & JS_EVENT_AXIS)
        m_axes[event.number] = normalizeAxisValue(event.value);
    else if (event.type & JS_EVENT_BUTTON)
        m_buttons[event.number] = normalizeButtonValue(event.value);

    m_lastTimestamp = event.time;
}