Android universal build
imjustmike
Member Posts: 450
Hey
What with the hundreds of different screen resolutions for android, instead of creating different apps I am attempting to build a single app that responds to the device screen size and moves things accordingly.
This is easy enough to do for iOS using an offset based on display size - I followed this tutorial:
It works perfectly, cropping the screen and moving actors to fit on iphone. Unfortunately the same rules don't seem to work when I test on android (using an ad hoc) - it just crops without moving the actors. This means that many of the actors in the croppable zone are not visible.
Is there any reasons why these rules aren't kicking in? Since the rules are based on screen size and moving actors on an offset I can't think of any reason why it wouldn't work.
Failing that, has anyone got any other solutions for building a responsive app on android? I know @deepblueapps showed tutorial a while ago that probably would work, but since it involves stretching actors, I'm not overly keen on using it
What with the hundreds of different screen resolutions for android, instead of creating different apps I am attempting to build a single app that responds to the device screen size and moves things accordingly.
This is easy enough to do for iOS using an offset based on display size - I followed this tutorial:
It works perfectly, cropping the screen and moving actors to fit on iphone. Unfortunately the same rules don't seem to work when I test on android (using an ad hoc) - it just crops without moving the actors. This means that many of the actors in the croppable zone are not visible.
Is there any reasons why these rules aren't kicking in? Since the rules are based on screen size and moving actors on an offset I can't think of any reason why it wouldn't work.
Failing that, has anyone got any other solutions for building a responsive app on android? I know @deepblueapps showed tutorial a while ago that probably would work, but since it involves stretching actors, I'm not overly keen on using it
Comments
Does anyone else have any experience with android publishing?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
My app starts with an iPad Landscape platform. In my home screen:
- I have an actor that calculates a ratio of the (game.screen.size.height/game.screen.size.width)
- If the ratio is above 0.7 (iPad or iPad mini), I do nothing to the static actors.
- If the ratio is <0.6 (like iPhone 5 or Samsung S4, Samsung 7" tab), I move the static actors down or up 88 pixels depending whether they are in the top half or bottom half of the screen.
-If the ratio is between 0.6 and 0.7 (like iPhone 4S, Samsung 10" and 8" tab), I move the static actors down or up 52 pixels.
This has worked so far for my iOS and android devices with adhoc builds using Overscan. However, with the android devices, I found that I needed to add a Reset Scene in the Home page for it to work. This calculation takes place in the first actor in the Background layer on the Home scene so I am not sure why it was not moving the actors like it does with my iOS devices. In order for this to work across all platforms (iOS and Android), it may be a good idea to make the first scene a blank page which has that actor which does the above calculation and sets the offset numbers into a global attribute, waits 0.2 seconds, then goes to the Home Screen of your game. This way, you won't see the static actors moving on the screen.
Thanks so much for the awesome nightly builds!!
-Ammar
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I found a bug in the 0.88 Nightly Build GSViewer.apk for Mac. I noticed that the Viewer only reads the device's screen dimensions accurately the first time it is run. If I switch to another app and come back to the Viewer again to run my app, it reverts back to the original Platform dimensions (in my case iPad). This happened on both my Samsung S4 and Galaxy Tab 10". So I think it has to do with the .apk itself.
Be sure to close the Viewer app completely before running it again.
Hymloe reported this bug to me. I was hoping to get to it on friday but I was not able to. I will be looking into the bug on monday.
@fryingbaconstudios - two less than screen height is quite a clever idea, requires less maths than creating an offset if the actors are always close to the edge. I'll have to use that on a hud I'm using on my next game.
@blackcloakGS - thanks for reply - do you have a rough idea of when a bug fix will be in a stable release?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS