Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Urgent help needed with weird display behaviour in APK but not when using the Player, plz

Author
Message
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 2nd Sep 2017 00:31 Edited at: 2nd Sep 2017 00:33
Hi Guys,

Now, I noticed this issue first a few months ago when I updated my Best Night Light app on Google Play; but only on a Samsung Galaxy Tab 2 tablet (running Android 4.x) which I just put down to just being an old device as none of my other test devices showed the same problem.



The above image is an example of the problem. You can see the the text on the black menu area hangs over the edge into the rest of the UI, also if you look closely the Lava lamp button (and the other two mode buttons, but they are hidden) are miss-shapen, they're supposed to be square). It also plays havoc with the help and about texts.

To be honest when I saw this I was confused as to how it'd managed to get through testing. I personally had tested it (on the player at least) on half a dozen test devices including the Tab 2. So I fired up the AppGameKit player on the tablet and lo and behold, this is what I saw...



It looks exactly as it does on all the other devices (which is how it's supposed to look!). I did bring this up with some other AGKers at the time, but nothing much came of it. However, the screen shots above aren't from the Galaxy Tab 2!! They are from a Kindle Fire 8 (6th Gen)!! So my issue isn't just limited to older devices, as the Kindle is fairly recent; but it also highlights a difference in behaviours between a compiled AppGameKit app, and one playing on the player.

It's been compiled with the latest version of AppGameKit, and I'm using percentage resolution with setscissor(0,0,0,0) in effect to remove the black bars.

So firstly, if anyone here with a spare 5 minutes and an Android phone/tablet to hand, can you just download my app and check out whether the screen looks like image 1 (bad) or image 2 (good). I'm concerned that such a bug is currently affecting an unknown percentage of devices, and could be a significant portion of my audience. (I have mostly Samsung Devices, which all have hardware buttons. The two tablets which showed the problem have buttons which appear at the bottom of the screen)

Secondly, and this is aimed more at Paul than anyone else, but can you look at why the Player is handling the screen properly but not the compiled apk? I will try and write a simple demonstration of this but I can't test it for a day or two currently as the Kindle was a loaner, and one of my kids has broken the charging wire for the Tab 2. I'm waiting on Amazon delivering me a new one.

Thanks in advance

=PRoF=
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 2nd Sep 2017 10:44 Edited at: 2nd Sep 2017 10:46
Have you set the sprites to keep their aspect?

Say you got a square bitmap as a sprite, and a 9/16 aspect screen. You could then set the sprite to size 40x22 (in percentage system) to get a square sprite. But if you then render the same sprite on a screen with lower aspect - say 9/18 - you'll get s sprite that looks too thin, and conversely on a screen that have a higher aspect, a sprite that looks too fat.

What you do to keep the aspect ratio of the sprite, is too set the height to -1. This will keep the sprite to the same aspect as the bitmap it uses no matter the aspect of the screen. So all you need worry about is the size of the sprite, which you set using the width parameter. So rather than say:

setSpriteSize(0, 40, 22)

You use:

setSpriteSize(0, 40, -1)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Sep 2017 11:04 Edited at: 2nd Sep 2017 11:05
have you used a formula for the font size? or maybe it belongs the UseNewDefaultFonts command.

i tested at two devices, looks ok there.
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 2nd Sep 2017 12:32 Edited at: 2nd Sep 2017 14:16
@Dybing:
My screen is based around a 4:3 aspect. (So for this project everything is drawn on a 1024x768 screen size). When used on a wide screen display, the main 4:3 area is in the middle of the screen and I use the GetScreenBoundsTop() command to align certain elements to the top/bottom of the screen. Sprites all have their sizes specified in percentages (both width and height). This has worked well on everything from 4:3 up to the new S8 super wide screen resolution (although not tested on an actual s8 yet).

The problem indicated in the above screen shots suggests that the device is displaying the screen at an aspect which is narrower than 4:3.

@Markus:
No formula, the text size is based on the 4:3 1024 x 768. And again, works fine from 4:3 all the way up to 16:9 and beyond

Can I ask what devices you tested it on, and whether they have actual buttons or ones on the bottom of the screen.


I'm thinking I can maybe work around it by changing my base resolution to 962 x 768, which should take into account the black bar with the buttons on it on the Tab 2/Kindle <-- This didn't work ; but I'm still concerned about the difference in behaviour between the Player playing the App, and the APK running on the device.

I think it has something to do with the way AppGameKit gets the screen size from the device (reporting 1024 x 768 for example, but only using 962 x 768); and I'm really puzzled as to why the player displays it properly, but not when I compile it to an apk.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Sep 2017 22:14
This is almost certainly a result of using the percentage based system instead of SetVirtualResolution, but I won't know for sure until I can test an example. The percentage system does a lot of scaling and stretching internally to make square images appear square on screen, since the 100x100 square resolution is being used to fill a 1024x768 non-square screen, so there may be a bug in there.

Login to post a reply

Server time is: 2024-09-30 07:26:45
Your offset time is: 2024-09-30 07:26:45