Package com.jme3.input.controls

Examples of com.jme3.input.controls.KeyTrigger


                flyCam.setMoveSpeed(1f); // odd to set this here but it did it before
                stateManager.getState(FlyCamAppState.class).setCamera( flyCam );
            }

            if (context.getType() == Type.Display) {
                inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE));
            }

            if (stateManager.getState(StatsAppState.class) != null) {
                inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5));
                inputManager.addListener(actionListener, INPUT_MAPPING_HIDE_STATS);           
            }
           
            inputManager.addListener(actionListener, INPUT_MAPPING_EXIT);           
        }
View Full Code Here


    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        if (!super.isInitialized()){
            InputManager inputManager = app.getInputManager();
            inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ));
            inputManager.addListener(this, "ScreenShot");

            List<ViewPort> vps = app.getRenderManager().getPostViews();
            ViewPort last = vps.get(vps.size()-1);
            last.addProcessor(this);
View Full Code Here

    scoreAppState.initialize(getStateManager(), this);
    scoreAppState.setEnabled(true);
    // stateManager.attach(scoreAppState);

    // pause unpause
    Trigger pauseTrigger = new KeyTrigger(KeyInput.KEY_SPACE);
    inputManager.addMapping("Game Pause Unpause", pauseTrigger);
    inputManager.addListener(this, new String[] { "Game Pause Unpause" });

    // init env state
    currentLevelAppState.score.initTime(timer.getTimeInSeconds());
View Full Code Here

        new int[] { KeyInput.KEY_P, KeyInput.KEY_L, KeyInput.KEY_O, KeyInput.KEY_K, KeyInput.KEY_I, KeyInput.KEY_J, KeyInput.KEY_U, KeyInput.KEY_H, KeyInput.KEY_Y, KeyInput.KEY_G, KeyInput.KEY_T,
            KeyInput.KEY_F, KeyInput.KEY_R, KeyInput.KEY_D, KeyInput.KEY_E, KeyInput.KEY_S, KeyInput.KEY_W, KeyInput.KEY_A, };

    for (int i = 0; i < numJoints; i++) {
      if (i < 9) { // only up to 9 joints (18 keys) bounded
        inputManager.addMapping("Right_" + i, new KeyTrigger(keyArray[2 * i]));
        inputManager.addListener(this, ("Right_" + i));
        inputManager.addMapping("Left_" + i, new KeyTrigger(keyArray[2 * i + 1]));
        inputManager.addListener(this, ("Left_" + i));
      }
    }
  }
View Full Code Here

  }

  /** 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");
  }
View Full Code Here

  /**
   * We over-write some navigational key mappings here, so we can add physics-controlled walking and jumping:
   */
  private void setUpKeys() {

    inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_A));
    inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_D));
    inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_S));
    inputManager.addMapping("Jump", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addListener(this, "Left");
    inputManager.addListener(this, "Right");
    inputManager.addListener(this, "Up");
    inputManager.addListener(this, "Down");
    inputManager.addListener(this, "Jump");
View Full Code Here

  /** Custom Keybinding: Map named actions to inputs. */
  private void initKeys() {

    // You can map one or several inputs to one named action
    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), new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    // Add the names to the action listener.
    inputManager.addListener(actionListener, new String[] { "Pause" });
    inputManager.addListener(analogListener, new String[] { "Left", "Right", "Rotate" });

  }
View Full Code Here

  }

  /** Custom Keybinding: Map named actions to inputs. */
  private void initKeys() {

    inputManager.addMapping("Walk", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addListener(actionListener, "Walk");
  }
View Full Code Here

  private void initializeInput() {
    inputManager.clearMappings();

    // Mouse Input
    inputManager.addMapping("RotateUp", new KeyTrigger(KeyInput.KEY_Y));
    inputManager.addMapping("RotateDown", new KeyTrigger(KeyInput.KEY_X));
    inputManager.addMapping("RotateLeft", new MouseAxisTrigger(MouseInput.AXIS_X, false));
    inputManager.addMapping("RotateRight", new MouseAxisTrigger(MouseInput.AXIS_X, true));

    // Keyboard Input
    inputManager.addMapping("Accelerate", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("Brake", new KeyTrigger(KeyInput.KEY_S));
    inputManager.addMapping("RollLeft", new KeyTrigger(KeyInput.KEY_Q));
    inputManager.addMapping("RollRight", new KeyTrigger(KeyInput.KEY_E));
    inputManager.addMapping("StrafeLeft", new KeyTrigger(KeyInput.KEY_A));
    inputManager.addMapping("StrafeRight", new KeyTrigger(KeyInput.KEY_D));

    inputManager.addMapping("bla", new KeyTrigger(KeyInput.KEY_LEFT));
    inputManager.addMapping("blubb", new KeyTrigger(KeyInput.KEY_RIGHT));

    inputManager.addListener(new InputListener(vehicleControl, player), new String[] { "RotateUp", "RotateDown",
        "RotateLeft", "RotateRight", "Accelerate", "Brake", "RollLeft", "RollRight", "StrafeLeft",
        "StrafeRight", "bla", "blubb" });
  }
View Full Code Here

    // jInputJoyInput = new JInputJoyInput();
    // joys = jInputJoyInput.loadJoysticks(inputManager);
    // jInputJoyInput.initialize();

    inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT));
    inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT));
    inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_UP));
    inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_DOWN));
    inputManager.addMapping("Taste", new KeyTrigger(KeyInput.KEY_Q));
    inputManager.addMapping("GibGas", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("Brems", new KeyTrigger(KeyInput.KEY_S));

    // inputManager.addMapping("Accelerate", new KeyTrigger(KeyInput.KEY_W));
    // inputManager.addMapping("Brake", new KeyTrigger(KeyInput.KEY_S));

    // inputManager.addMapping("MouseXleft", new JoyAxisTrigger(0,
View Full Code Here

TOP

Related Classes of com.jme3.input.controls.KeyTrigger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.