I am an Android developer, having created my first game using LibGDX. After reading A LOT, there is still one thing that I do not understand.
I understand that I must have one set of images, for the highest resolution of 2560x1440 (to prevent the ugly scaling of non-vector images).
I use TexturePacker to pack my images and even use linear linear to get maximum quality:
TexturePacker.Settings settings = new TexturePacker.Settings(); settings.filterMin = Texture.TextureFilter.Linear; settings.filterMag = Texture.TextureFilter.Linear; settings.maxWidth = 4096; settings.maxHeight = 2048; TexturePacker.process(settings, inputDir, outputDir, packFileName);
I installed my camera, as recommended in several SOs, on fixed counters and avoided all the PPM stuff. From the C'TOR screen:
mCamera = new OrthographicCamera(); mCamera.viewportWidth = 25.6f; ;
As you can see, I decided to work with 1 meter = 100 pixels.
Now this means that I have to draw my 1/100 sprites, which I do here:
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("images/pack.atlas")); mImage = atlas.createSprite("image")); mImage.setSize(mImage.getWidth() / 100 , mImage.getHeight() / 100);
This works and the images are displayed as intended. BUT, they are distorted like hell! an absolutely round image looks uneven at the edges, not round.
So my questions are:
- Is this the best practice or do I need to work differently?
- Am I correct only the highest quality images?
- Is the distortion meaning that my code really reduces the sprite and somehow libgdx expanded it again and damaged the quality?
Thanks!
EDIT
I am going to adapt @ Tenfour04 answers to (1) and (2).
As for (3), the problem is related to Genymotion :(, its pixelization of the game. I tested it on real devices with several resolutions and looked perfect.