Ejemplo n.º 1
0
  @Override
  public void run() {
    while (!Thread.currentThread().isInterrupted()) {
      long time = System.currentTimeMillis();
      stateManager.update((float) 0.02);
      long nextTick = (long) (time + 20);
      long towait = nextTick - System.currentTimeMillis();

      tickCount++;
      waitTime += towait;

      if (towait > 0)
        try {
          Thread.sleep(towait);
        } catch (InterruptedException e) {
          break;
        }
    }
  }