List of usage examples for com.badlogic.gdx.controllers PovDirection center
PovDirection center
To view the source code for com.badlogic.gdx.controllers PovDirection center.
Click Source Link
From source file:com.intrepid.nicge.controller.keyboard.KeyboardPOV.java
@Override public void update() { direction = PovDirection.center; boolean x = MathUtilz.logic.NXOR(left, right); boolean y = MathUtilz.logic.NXOR(up, down); if (x && y) { return;/*from w w w .ja v a2 s .c o m*/ } if (x) { if (left) { direction = PovDirection.west; } else { direction = PovDirection.east; } } if (y) { if (direction == PovDirection.center) { if (up) { direction = PovDirection.north; } else { direction = PovDirection.south; } } else { if (up) { if (direction == PovDirection.east) { direction = PovDirection.northEast; } else { direction = PovDirection.northWest; } } else { if (direction == PovDirection.east) { direction = PovDirection.southEast; } else { direction = PovDirection.southWest; } } } } }
From source file:org.ah.gcc.rover.desktop.DesktopRealController.java
License:Open Source License
@Override public boolean povMoved(Controller controller, int povCode, PovDirection value) { // System.out.println("new pov: " + value.toString()); if (value == PovDirection.center) { state.getHat1().set(JoystickState.zero()); } else if (value == PovDirection.north) { state.getHat1().set(0, 1);/* w w w . j a va 2 s .co m*/ } else if (value == PovDirection.south) { state.getHat1().set(0, -1); } else if (value == PovDirection.east) { state.getHat1().set(1, 0); } else if (value == PovDirection.west) { state.getHat1().set(-1, 0); } else if (value == PovDirection.northEast) { state.getHat1().set(1, 1); } else if (value == PovDirection.northWest) { state.getHat1().set(-1, 1); } else if (value == PovDirection.southEast) { state.getHat1().set(1, -1); } else if (value == PovDirection.southWest) { state.getHat1().set(-1, -1); } return false; }