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(); } } }
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; }
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(); } }