Example usage for android.view MotionEvent AXIS_RX

List of usage examples for android.view MotionEvent AXIS_RX

Introduction

In this page you can find the example usage for android.view MotionEvent AXIS_RX.

Prototype

int AXIS_RX

To view the source code for android.view MotionEvent AXIS_RX.

Click Source Link

Document

Axis constant: X Rotation axis of a motion event.

Usage

From source file:org.gearvrf.controls.Worm.java

public void interactWithDPad() {

    if (!ScaleWorm.animPlaying) {

        if (GamepadInput.getCenteredAxis(MotionEvent.AXIS_HAT_X) >= 1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_X) >= 1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_RX) >= 1) {

            rotateAroundCamera(.1f, -5f);
            rotateWorm(MovementDirection.Right);
        }//from ww w .ja va  2  s .  c  om
        if (GamepadInput.getCenteredAxis(MotionEvent.AXIS_HAT_X) <= -1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_X) <= -1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_RX) <= -1) {

            rotateAroundCamera(.1f, 5f);
            rotateWorm(MovementDirection.Left);
        }
        if (GamepadInput.getCenteredAxis(MotionEvent.AXIS_HAT_Y) >= 1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_Y) >= 1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_RY) >= 1) {

            moveAlongCameraVector(.1f, -.225f);
            rotateWorm(MovementDirection.Down);
        }
        if (GamepadInput.getCenteredAxis(MotionEvent.AXIS_HAT_Y) <= -1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_Y) <= -1
                || GamepadInput.getCenteredAxis(MotionEvent.AXIS_RY) <= -1) {

            moveAlongCameraVector(.1f, .225f);
            rotateWorm(MovementDirection.Up);
        }
    }
}