Friday, October 10, 2014

Main menu, resolution and multiple device dimensions

So a problem with the main menu was fixed, whereas a translationVector was added to get the correct X, Y position, as the Y axis is reverted. Also a small bug was corrected with the highscore, it would seem that the spritebatch.end() was called inside of a if statement that was not always true, prompting the game to crash.

We hit a major problem today with getting the resolution to work with multiple devices. It would seem that there was some hardcoded settings in the code that made it look great on iPhone and android mobile phones. This is most likely because of the 16:9 ratio that most phones have. When trying the game on an iPad with 4:3 ratio though it made some weird graphical bugs which I though that I fixed with some small adjustments to the gameScreen and gameRenderer classes. Like changing the orthographic camera viewports and calculating a correct gameWidth. But it would seem that it instead made it look very bad and streached on android devices which has a resolution of 1920x1080. This means that we most likely need to change like everything that is hardcoded with pixels in the game. Since we originally had a viewport of 1024x576 we could hardcode objects with pixels have have it appear the same on every screen with a 16:9 resolution. But we need to make all the objects relative to the screen resolution now, and that is a lot of code to redo.

Here are two pictures of what it looks like on iphone and android with the streached version.
Iphone 5s

Samsung Galaxy S4