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

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

Introduction

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

Prototype

int AXIS_LEFT_Y

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

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;//  w  ww  . jav a 2 s. 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;
}

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

License:Apache License

@Override
public boolean axisMoved(Controller controller, int axisCode, float value) {
    if (Math.abs(value) > 0.99f) {
        if (axisCode == Ouya.AXIS_LEFT_Y && value < 0.0f) {
            Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad up button pressed.");
            oButtonSelection = (oButtonSelection + 1) % NUM_MENU_BUTTONS;
        } else if (axisCode == Ouya.AXIS_LEFT_Y && value >= 0.0f) {
            Gdx.app.log(TAG, CLASS_NAME + ".buttonDown(): Dpad down button pressed.");
            oButtonSelection = oButtonSelection - 1 < 0 ? NUM_MENU_BUTTONS - 1 : oButtonSelection - 1;
        }//  w  ww.j  a  va  2  s.co m

        return true;
    }

    return false;
}