예제 #1
0
  /**
   * Special version of changeGLController(), won't call pause() or dispose() in old GLController.
   * Can for example be used if assets are transferred between GLController's. Can be called from
   * anywhere within a GLController. Will pause and dispose of old GLController.
   *
   * @throws IllegalArgumentException if new GLController is null
   * @param glController the new GLController
   */
  public void changeGLControllerDontDispose(GLController glController) {
    if (glController == null) {
      throw new IllegalArgumentException("New GLController is null, not allowed.");
    }

    // Resumes new GLController
    glController.onResume();
    this.glController = glController;

    catchBackKey(glController.catchBackKey());
  }
예제 #2
0
  /**
   * Changes GLController Can be called from anywhere within a GLController. Will pause and dipose
   * of old GLController.
   *
   * @throws IllegalArgumentException if new GLController is null
   * @param glController the new GLController
   */
  @Deprecated // TODO: Not really deprecated, but is needed to make sure people don't use wrong
              // method in project.
  public void changeGLController(GLController glController) {
    if (glController == null) {
      throw new IllegalArgumentException("New GLController is null, not allowed.");
    }

    // Dispose of old GLController
    this.glController.onPause();
    this.glController.dispose();

    // Resumes new GLController
    glController.onResume();
    this.glController = glController;

    catchBackKey(glController.catchBackKey());
  }
예제 #3
0
  @Override
  public void onSurfaceCreated(GL10 unused, EGLConfig config) {
    // Resets fps counter.
    startTime = System.nanoTime();
    lastFPSCount = startTime;
    frameCount = 0;
    fps = 0;
    deltaTime = 0;

    synchronized (this) {
      if (state == State.STARTING) { // Gets initial GLController if program is starting up.
        glController = getInitialGLController(this);
      }
      state = State.RUNNING; // Surface was created, so program is running.
      glController.onResume();
    }
  }