I’m trying to scale my game’s screen to compensate for different aspect ratios. I’ve followed this tutorial: http://blog.acamara.es/2012/02/05/keep-screen-aspect-ratio-with-different-resolutions-using-libgdx/ and have been mildly successful. It properly scales and applies letterboxing, but at most resolutions, unless it’s a perfectly divisible by itself resolution (480/270, 960/540, etc…) of 16:9 aspect ratio, some of the pixels stretch across the screen looking very ugly as seen below:
Pixels stretching at 800x480 (Galaxy S2 resolution)
Pixels not stretching at 960/540; double the resolution of the virtual resolution the game is programmed in.
The code I’m using for the camera:
http://pastebin.com/92GkkUjD
PetsimGame.CAMERA_HEIGHT and _WIDTH are the virtual screen sizes hardcoded at 480 and 270 respectively.
Can anyone shine some light on my delima. I’ve been try to debug this one for quite a while with little luck and I’ve gotten at least this far. Any help would be appreciated!