Example #1
0
  public static void setupInputManager(
      final InputManager inputManager, final ActionListener actionListener) {
    if (inputManager != null) {
      //            inputManager.addMapping("SIMPLEAPP_CameraPos", new KeyTrigger(KeyInput.KEY_C));
      //            inputManager.addMapping("SIMPLEAPP_Memory", new KeyTrigger(KeyInput.KEY_M));
      //            inputManager.addListener(actionListener, "SIMPLEAPP_Exit",
      //                    "SIMPLEAPP_CameraPos", "SIMPLEAPP_Memory");

      inputManager.deleteMapping("SIMPLEAPP_Exit");
      inputManager.addMapping(INPUT_MAPPING_SHOW_MAIN_MENU, new KeyTrigger(KeyInput.KEY_ESCAPE));
      inputManager.addListener(actionListener, INPUT_MAPPING_SHOW_MAIN_MENU);

      //            //testing
      //            inputManager.addMapping("BUTTON_LEFT", new
      // MouseButtonTrigger(MouseInput.BUTTON_LEFT));
      //            inputManager.addMapping("BUTTON_MIDDLE", new
      // MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
      //            inputManager.addMapping("BUTTON_RIGHT", new
      // MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
      //            inputManager.addMapping("AXIS_WHEEL", new
      // MouseButtonTrigger(MouseInput.AXIS_WHEEL));
      //            inputManager.addMapping("AXIS_X", new MouseButtonTrigger(MouseInput.AXIS_X));
      //            inputManager.addMapping("AXIS_Y", new MouseButtonTrigger(MouseInput.AXIS_Y));
      //            inputManager.addMapping("AXIS_WHEEL, false", new
      // MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
      //            inputManager.addMapping("AXIS_WHEEL, true", new
      // MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
      //            inputManager.addMapping("AXIS_X, false", new MouseAxisTrigger(MouseInput.AXIS_X,
      // false));
      //            inputManager.addMapping("AXIS_X, true", new MouseAxisTrigger(MouseInput.AXIS_X,
      // true));
      //            inputManager.addMapping("AXIS_Y, false", new MouseAxisTrigger(MouseInput.AXIS_Y,
      // false));
      //            inputManager.addMapping("AXIS_Y, true", new MouseAxisTrigger(MouseInput.AXIS_Y,
      // true));
      //
      //            inputManager.addListener(actionListener,
      //                    "BUTTON_LEFT", "BUTTON_MIDDLE", "BUTTON_RIGHT",
      //                    "AXIS_WHEEL", "AXIS_X", "AXIS_Y",
      //                    "AXIS_WHEEL, false", "AXIS_WHEEL, true", "AXIS_X, false", "AXIS_X,
      // true", "AXIS_Y, false", "AXIS_Y, true");
    }
  }
Example #2
0
  /** Suppression des contrôles par défaut, puis nouveau mapping de contrôle plus adapter. */
  public void setupControls() {
    // Removing some shortcut
    inputManager.deleteMapping("FLYCAM_Left");
    inputManager.deleteMapping("FLYCAM_Right");
    inputManager.deleteMapping("FLYCAM_Up");
    inputManager.deleteMapping("FLYCAM_Down");
    inputManager.deleteMapping("FLYCAM_StrafeLeft");
    inputManager.deleteMapping("FLYCAM_StrafeRight");
    inputManager.deleteMapping("FLYCAM_Forward");
    inputManager.deleteMapping("FLYCAM_Backward");
    inputManager.deleteMapping("FLYCAM_Rise");
    inputManager.deleteMapping("FLYCAM_Lower");
    inputManager.deleteMapping("FLYCAM_ZoomIn");
    inputManager.deleteMapping("FLYCAM_ZoomOut");

    // Keyboard
    // -- empty

    // Mouse
    inputManager.addMapping("RotateEnable", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addMapping("MoveEnable", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
    inputManager.addMapping("MoveX-L", new MouseAxisTrigger(MouseInput.AXIS_X, true));
    inputManager.addMapping("MoveX-R", new MouseAxisTrigger(MouseInput.AXIS_X, false));
    inputManager.addMapping("MoveY-U", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
    inputManager.addMapping("MoveY-D", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
    inputManager.addMapping("ZoomIn", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
    inputManager.addMapping("ZoomOut", new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));

    moveEnable = false;
    rotateEnable = false;
    inputManager.setCursorVisible(true);

    inputManager.addListener(actionListener, new String[] {"MoveEnable", "RotateEnable", "TEST"});
    inputManager.addListener(
        analogListener,
        new String[] {"MoveX-L", "MoveX-R", "MoveY-U", "MoveY-D", "ZoomIn", "ZoomOut"});
  }