コード例 #1
0
ファイル: InputManager.java プロジェクト: brianhgt/jme4webgl
  /**
   * Updates the <code>InputManager</code>. This will query current input devices and send
   * appropriate events to registered listeners.
   *
   * @param tpf Time per frame value.
   */
  public void update(float tpf) {
    frameTPF = tpf;

    // Activate safemode if the TPF value is so small
    // that rounding errors are inevitable
    safeMode = tpf < 0.015f;

    long currentTime = keys.getInputTimeNanos();
    frameDelta = currentTime - lastUpdateTime;

    eventsPermitted = true;

    keys.update();
    mouse.update();
    if (joystick != null) {
      joystick.update();
    }
    if (touch != null) {
      touch.update();
    }

    eventsPermitted = false;

    processQueue();
    invokeUpdateActions();

    lastLastUpdateTime = lastUpdateTime;
    lastUpdateTime = currentTime;
  }
コード例 #2
0
ファイル: InputManager.java プロジェクト: brianhgt/jme4webgl
 /** Returns state of simulation of mouse events. Used for touchscreen input only. */
 public boolean getSimulateMouse() {
   if (touch != null) {
     return touch.getSimulateMouse();
   } else {
     return false;
   }
 }
コード例 #3
0
ファイル: InputManager.java プロジェクト: brianhgt/jme4webgl
  /**
   * Initializes the InputManager.
   *
   * <p>This should only be called internally in {@link Application}.
   *
   * @param mouse
   * @param keys
   * @param joystick
   * @param touch
   * @throws IllegalArgumentException If either mouseInput or keyInput are null.
   */
  public InputManager(MouseInput mouse, KeyInput keys, JoyInput joystick, TouchInput touch) {
    if (keys == null || mouse == null) {
      throw new NullPointerException("Mouse or keyboard cannot be null");
    }

    this.keys = keys;
    this.mouse = mouse;
    this.joystick = joystick;
    this.touch = touch;

    keys.setInputListener(this);
    mouse.setInputListener(this);
    if (joystick != null) {
      joystick.setInputListener(this);
      joysticks = joystick.loadJoysticks(this);
    }
    if (touch != null) {
      touch.setInputListener(this);
    }

    firstTime = keys.getInputTimeNanos();
  }
コード例 #4
0
ファイル: InputManager.java プロジェクト: brianhgt/jme4webgl
 /**
  * Enable simulation of keyboard events. Used for touchscreen input only.
  *
  * @param value True to enable simulation of keyboard events
  */
 public void setSimulateKeyboard(boolean value) {
   if (touch != null) {
     touch.setSimulateKeyboard(value);
   }
 }
コード例 #5
0
ファイル: InputManager.java プロジェクト: brianhgt/jme4webgl
 /**
  * Enable simulation of mouse events. Used for touchscreen input only.
  *
  * @param value True to enable simulation of mouse events
  */
 public void setSimulateMouse(boolean value) {
   if (touch != null) {
     touch.setSimulateMouse(value);
   }
 }