Note that there are some explanatory texts on larger screens.

plurals
  1. POLibGdx - need help on Screen class
    text
    copied!<p>I've been using <code>libgdx</code> for the past 3 weeks.. I created two screens referencing to a game:</p> <pre><code>public class Game extends Game { TitleScreen titleScreen; SplashScreen splashScreen; @Override public void create() { // TODO Auto-generated method stub titleScreen = new TitleScreen(this); splashScreen = new SplashScreen(this); setScreen(splashScreen); } </code></pre> <p>}</p> <p>and </p> <pre><code>public class SplashScreen implements Screen { Game game; public SplashScreen(Game game) { // TODO Auto-generated constructor stub this.game = game; } @Override public void show() { // TODO Auto-generated method stub } @Override public void hide() { // TODO Auto-generated method stub } @Override public void render(float delta) { // TODO Auto-generated method stub Gdx.gl.glClearColor(0.5f, 1f, 1f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); if(Gdx.input.justTouched()){ game.splashScreen.dispose(); game.setScreen(game.titlescreen); } } @Override public void resize(int width, int height) { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } </code></pre> <p>How do I dispose the <code>splashscreen</code> entirely? When I called the <code>game.setscreen(game.splashscreen)</code> in <code>titlescreen</code> class, it resume the <code>splashscreen</code>;. I'm expecting to set a new <code>splashscreen</code>..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload