Exemplo n.º 1
0
  /**
   * 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;
  }