-2

Can someone just give me a real quick answer on how i would implement a viewport so this sprite would fill the whole screen?

Thanks

Current code (not working):

public SplashScreen(Jump game)
{
    this.game = game;   

    cam = new OrthographicCamera();

    cam.setToOrtho(false, 1920, 1080);

    sb = new SpriteBatch();
}

public void show() 
{

}

public void render(float delta) 
{
    Gdx.gl20.glClearColor(0.2F, 0.6F, 1F, 1F);

    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    cam.update();

    sb.setProjectionMatrix(cam.combined);

    sb.begin();

    sb.draw(Assets.splash_spr_background, 0, 0);

    sb.end();

}
Adam Brodin
  • 63
  • 1
  • 2
  • 13

1 Answers1

0

On

 @Override
    public void resize(int width, int height) {
        stage.getViewport().update(Gdx.graphics.getWidth(),
                Gdx.graphics.getHeight(), false); 

}

as spritebatch does not have a viewport. You have to control this using stage or cam.

you can do that.

Aiman Batul
  • 144
  • 11