Example usage for com.badlogic.gdx.controllers.mappings Ouya AXIS_RIGHT_X

List of usage examples for com.badlogic.gdx.controllers.mappings Ouya AXIS_RIGHT_X

Introduction

In this page you can find the example usage for com.badlogic.gdx.controllers.mappings Ouya AXIS_RIGHT_X.

Prototype

int AXIS_RIGHT_X

To view the source code for com.badlogic.gdx.controllers.mappings Ouya AXIS_RIGHT_X.

Click Source Link

Usage

From source file:ve.ucv.ciens.ccg.nxtar.states.InGameState.java

License:Apache License

@Override
public boolean axisMoved(Controller controller, int axisCode, float value) {
    GamepadUserInput userInput = null;//ww  w.java  2s .  c o m

    if (Math.abs(value) > Ouya.STICK_DEADZONE) {
        userInput = new GamepadUserInput();
        if (axisCode == Ouya.AXIS_LEFT_X) {
            userInput.axisLeftX = value;
        } else if (axisCode == Ouya.AXIS_LEFT_Y) {
            userInput.axisLeftY = value;
        } else if (axisCode == Ouya.AXIS_RIGHT_X) {
            userInput.axisRightX = value;
        } else if (axisCode == Ouya.AXIS_RIGHT_Y) {
            userInput.axisRightY = value;
        }

    } else if (Math.abs(value) <= Ouya.STICK_DEADZONE && Math.abs(value) > 0.15f) {
        userInput = new GamepadUserInput();
        if (axisCode == Ouya.AXIS_LEFT_X) {
            userInput.axisLeftX = 0.0f;
        } else if (axisCode == Ouya.AXIS_LEFT_Y) {
            userInput.axisLeftY = 0.0f;
        } else if (axisCode == Ouya.AXIS_RIGHT_X) {
            userInput.axisRightX = 0.0f;
        } else if (axisCode == Ouya.AXIS_RIGHT_Y) {
            userInput.axisRightY = 0.0f;
        }
    }

    if (userInput != null) {
        robotArmPositioningSystem.setUserInput(userInput);
        robotArmPositioningSystem.process();
        return true;
    }

    return false;
}