public int triggerHashCode() { return mouseAxisHash(mouseAxis, negative); } }
public int triggerHashCode() { return keyHash(keyCode); }
public int triggerHashCode() { return joyButtonHash(joyId, buttonId); }
/** Declaring the "Shoot" action and mapping to its triggers. */ private void initKeys() { inputManager.addMapping("Shoot", new KeyTrigger(KeyInput.KEY_SPACE), // trigger 1: spacebar new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); // trigger 2: left-button click inputManager.addListener(actionListener, "Shoot"); } /** Defining the "Shoot" action: Determine what was hit and how to respond. */
public void registerInput() { inputManager.addMapping("moveForward", new KeyTrigger(keyInput.KEY_UP), new KeyTrigger(keyInput.KEY_W)); inputManager.addMapping("moveBackward", new KeyTrigger(keyInput.KEY_DOWN), new KeyTrigger(keyInput.KEY_S)); inputManager.addMapping("moveRight", new KeyTrigger(keyInput.KEY_RIGHT), new KeyTrigger(keyInput.KEY_D)); inputManager.addMapping("moveLeft", new KeyTrigger(keyInput.KEY_LEFT), new KeyTrigger(keyInput.KEY_A)); inputManager.addMapping("toggleRotate", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addMapping("rotateRight", new MouseAxisTrigger(MouseInput.AXIS_X, true)); inputManager.addMapping("rotateLeft", new MouseAxisTrigger(MouseInput.AXIS_X, false)); inputManager.addListener(this, "moveForward", "moveBackward", "moveRight", "moveLeft"); inputManager.addListener(this, "rotateRight", "rotateLeft", "toggleRotate"); }
public void registerInput() { inputManager.addMapping("moveForward", new KeyTrigger(keyInput.KEY_UP), new KeyTrigger(keyInput.KEY_W)); inputManager.addMapping("moveBackward", new KeyTrigger(keyInput.KEY_DOWN), new KeyTrigger(keyInput.KEY_S)); inputManager.addMapping("moveRight", new KeyTrigger(keyInput.KEY_RIGHT), new KeyTrigger(keyInput.KEY_D)); inputManager.addMapping("moveLeft", new KeyTrigger(keyInput.KEY_LEFT), new KeyTrigger(keyInput.KEY_A)); inputManager.addMapping("displayPosition", new KeyTrigger(keyInput.KEY_P)); inputManager.addListener(this, "moveForward", "moveBackward", "moveRight", "moveLeft"); inputManager.addListener(this, "displayPosition"); }
@Override public void simpleInitApp() { // Test multiple inputs per mapping inputManager.addMapping("My Action", new KeyTrigger(KeyInput.KEY_SPACE), new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false)); // Test multiple listeners per mapping inputManager.addListener(actionListener, "My Action"); inputManager.addListener(analogListener, "My Action"); }
/** Add InputManager action: Left click triggers shooting. */ private void initInputs() { inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "shoot"); }
private void initVerticalAxisInputs() { if (!invertYaxis) { inputManager.addMapping(CameraInput.CHASECAM_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, true)); inputManager.addMapping(CameraInput.CHASECAM_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, false)); } else { inputManager.addMapping(CameraInput.CHASECAM_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, false)); inputManager.addMapping(CameraInput.CHASECAM_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, true)); } }
public int triggerHashCode() { return touchHash(keyCode); }
public int triggerHashCode() { return joyAxisHash(joyId, axisId, negative); }
public int triggerHashCode() { return mouseButtonHash(mouseButton); }
/** Custom Keybinding: Map named actions to inputs. */ private void initKeys() { /** You can map one or several inputs to one named mapping. */ inputManager.addMapping("Pause", new KeyTrigger(keyInput.KEY_P)); inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_J)); inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_K)); inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE), // spacebar! new MouseButtonTrigger(MouseInput.BUTTON_LEFT) ); // left click! /** Add the named mappings to the action listeners. */ inputManager.addListener(actionListener,"Pause"); inputManager.addListener(analogListener,"Left", "Right", "Rotate"); }
/** * Sets up the keyboard bindings */ private void Keys() { inputManager.addMapping("START", new KeyTrigger(KeyInput.KEY_RETURN)); inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT)); inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT)); inputManager.addListener(this, "START", "Left", "Right"); }
/** Declaring "Shoot" action, mapping it to a trigger (mouse left click). */ private void initKeys() { inputManager.addMapping("Shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "Shoot"); }
private void initKeys() { // You can map one or several inputs to one named action this.inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A)); this.inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D)); this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W)); this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S)); this.inputManager.addMapping("Jumps", new KeyTrigger(KeyInput.KEY_SPACE)); this.inputManager.addMapping("pick", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); this.inputManager.addListener(this.actionListener, "Lefts"); this.inputManager.addListener(this.actionListener, "Rights"); this.inputManager.addListener(this.actionListener, "Ups"); this.inputManager.addListener(this.actionListener, "Downs"); this.inputManager.addListener(this.actionListener, "Jumps"); this.inputManager.addListener(this.actionListener, "pick"); } private boolean left;
private void setupKeys() { inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_H)); inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_K)); inputManager.addMapping("Swing", new KeyTrigger(KeyInput.KEY_SPACE)); inputManager.addListener(this, "Left", "Right", "Swing"); }
private void setupKeys() { flyCam.setMoveSpeed(100); inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T)); inputManager.addListener(actionListener, "wireframe"); inputManager.addMapping("Raise", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "Raise"); inputManager.addMapping("Lower", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)); inputManager.addListener(actionListener, "Lower"); } private ActionListener actionListener = new ActionListener() {
private void initKeys() { // You can map one or several inputs to one named action this.inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A)); this.inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D)); this.inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W)); this.inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S)); this.inputManager.addListener(this.actionListener, "Lefts"); this.inputManager.addListener(this.actionListener, "Rights"); this.inputManager.addListener(this.actionListener, "Ups"); this.inputManager.addListener(this.actionListener, "Downs"); } private boolean left;
private void initInputs() { inputManager.addMapping("toggle", new KeyTrigger(KeyInput.KEY_SPACE)); ActionListener acl = new ActionListener() { public void onAction(String name, boolean keyPressed, float tpf) { if (name.equals("toggle") && keyPressed) { pf.setEnabled(!pf.isEnabled()); } } }; inputManager.addListener(acl, "toggle"); }