Pages

Thursday, August 21, 2014

First game prototype almost done! One problem to solve... different densities

 

So there it is. You can see a device with 480x800 resolution on the left and a device with 1080x1920 on the right. This is wrong for sure. Problem is that when making an native android application there are folders for different screen densities and the app chooses assets depending on screen densities/sizes. There is another way in libgdx to deal with it, but im not familiar with it yet. Probably you need to load several sizes of one image and switch between them depending on screen size. That is really easy to implement using the Gdx.graphics.getHeight() and choosing different images to load depending on the value returned from that method, but i better learn about the ready solution first. There are some probable pitfalls concerning image coordinates if they are of a different size. Probably this can be solved by not using actual pixel coordinates, but using instead proportions of the screen, like Gdx.graphics.getHeight()/10 etc.

No comments:

Post a Comment