Problem when scaling game screen in Libgdx
Posted
by
Nicolas Martel
on Game Development
See other posts from Game Development
or by Nicolas Martel
Published on 2013-10-24T00:34:09Z
Indexed on
2013/10/24
4:10 UTC
Read the original article
Hit count: 278
Currently, I'm able to scale the screen by applying this bit of code onto an OrthographicCamera
Camera.setToOrtho(true, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
But something quite strange is happening with this solution, take a look at this picture of my game below
Seems fine right? But upon further investigation, many components are rendered off by one pixels, and the tiles all are.
Take a closer look
I circled a couple of the errors. Note that the shadow of the warrior I circled appears fine for the other warriors. Also keep in mind that everything is rendered at pixel-perfect precision when I disable the scaling.
I actually thought of a possible source for the problem as I'm writing this but I decided to still post this because I would assume somebody else might run into the same issue.
© Game Development or respective owner