So i am creating a splash screen and i want the background to fill the whole screen.
But by using this code it does not work, it only fills a portion of the screen.
Here's the code:
For initializing the camera & other stuff:
public SplashScreen(Jump game)
{
this.game = game;
cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
sb = new SpriteBatch();
}
And here is the code for drawing the background to the screen:
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.begin();
sb.setProjectionMatrix(cam.combined);
sb.draw(Assets.splash_spr_background, 0, 0);
sb.end();
}
And lastly here is the code for initializing the background sprite:
public static Texture splash_tex_background;
public static Sprite splash_spr_background;
public static void init()
{
splash_tex_background = new Texture(Gdx.files.internal("Splash Screen/background.png"));
splash_tex_background.setFilter(TextureFilter.Linear, TextureFilter.Linear);
splash_spr_background = new Sprite(splash_tex_background);
}
This does not work obviously (that's why im posting this) and here is how it looks when i run the program:
And now my questions are the following:
·How do i make the background fill the whole screen?
·What have i done wrong/forgot to type?