I’m trying to scale my app for multiple devices. So here is what I use to render things on the screen. Sadly, it only fits a certain phone.
INIT()/CREATE()
camera = new OrthographicCamera();
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
ps = new Sprite(new Texture(Gdx.files.internal("playerZ")));
ps.setPosition(camera.viewportWidth/2, 100);
RENDER()
Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
update(1/60f);
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
ps.draw(batch);
batch.end();
This draw the image fine, but (using the emulator and my phone) this doesn’t look the same on different resolutions.