コード例 #1
0
  public void onDrawFrame(GL10 gl) {
    GLGameState state = null;

    synchronized (stateChanged) {
      state = this.state;
    }

    if (state == GLGameState.Running) {
      float deltaTime = (System.nanoTime() - startTime) / 1000000000.0f;
      startTime = System.nanoTime();

      screen.update(deltaTime);
      screen.present(deltaTime);
    }

    if (state == GLGameState.Paused) {
      screen.pause();
      synchronized (stateChanged) {
        this.state = GLGameState.Idle;
        stateChanged.notifyAll();
      }
    }

    if (state == GLGameState.Finished) {
      screen.pause();
      screen.dispose();
      synchronized (stateChanged) {
        this.state = GLGameState.Idle;
        stateChanged.notifyAll();
      }
    }
  }
コード例 #2
0
  public void setScreen(Abstract_Screen screen) {
    if (screen == null) {
      Log_Exception.logEvent("Error Code 13", "Screen must not be Null");
      throw new IllegalArgumentException("Error Code 13 : " + "Screen must not be null");
    }

    this.screen.pause();
    this.screen.dispose();
    screen.resume();
    screen.update(0);
    this.screen = screen;
  }
コード例 #3
0
  public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    glGraphics.setGL(gl);

    synchronized (stateChanged) {
      if (state == GLGameState.Initialized) screen = getStartScreen();
      state = GLGameState.Running;
      screen.resume();
      startTime = System.nanoTime();
    }
  }