android.view.MotionEvent#AXIS_BRAKE源码实例Demo

下面列出了android.view.MotionEvent#AXIS_BRAKE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: 365browser   文件: GamepadMappings.java
UnknownGamepadMappings(int[] axes) {
    int hatAxesFound = 0;

    for (int axis : axes) {
        switch (axis) {
            case MotionEvent.AXIS_LTRIGGER:
            case MotionEvent.AXIS_BRAKE:
                mLeftTriggerAxis = axis;
                break;
            case MotionEvent.AXIS_RTRIGGER:
            case MotionEvent.AXIS_GAS:
            case MotionEvent.AXIS_THROTTLE:
                mRightTriggerAxis = axis;
                break;
            case MotionEvent.AXIS_RX:
            case MotionEvent.AXIS_Z:
                mRightStickXAxis = axis;
                break;
            case MotionEvent.AXIS_RY:
            case MotionEvent.AXIS_RZ:
                mRightStickYAxis = axis;
                break;
            case MotionEvent.AXIS_HAT_X:
                hatAxesFound++;
                break;
            case MotionEvent.AXIS_HAT_Y:
                hatAxesFound++;
                break;
            default:
                break;
        }
    }

    if (hatAxesFound == 2) {
        mUseHatAxes = true;
    }
}
 
源代码2 项目: 365browser   文件: GamepadMappings.java
private static void mapPedalAxesToBottomShoulder(float[] mappedButtons, float[] rawAxes) {
    float lTrigger = rawAxes[MotionEvent.AXIS_BRAKE];
    float rTrigger = rawAxes[MotionEvent.AXIS_GAS];
    mappedButtons[CanonicalButtonIndex.LEFT_TRIGGER] = lTrigger;
    mappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER] = rTrigger;
}