I've been trying to fix a little issue I'm having with an Orx game running on an LG G3(Android 5.0, 2560x1440). Note that I've run the same game on two other devices (Galaxy Note 10.1:[4.1.2], HTC Desire S:[2.3.5]) and they don't have this issue.
The problem is that the orx surface view seems to leave a 84pixel margin on the left and right sides on landscape orientation, and I can't remove that margin in a reasonable manner. I've been fighting with that issue for a few days now, so I've gained some insight into it:
First of all, I've noticed that when the orx activity is first created, it's for some reason created with those margins, and they're immediately removed, but at that point, orx has already initialized itself. I've tried to log the width of the SurfaceView at various times and here's what happens:
When the surface is first created: 2392 px
In my native Init function: 2392 px
Very shortly afterwards: 2560 px
I've tried to remove the margins in the dimens.xml file (both of them) and it doesn't help. I've discovered something that DOES help; inside src/res/values/themes.xml, when you change the parent of MyStyle from @android
:style/Theme.NoTitleBar.Fullscreen to @android
:style/Theme.NoTitleBar, the visual margins disappear, but there's still something fishy about it: Even though the margins disappear, the SurfaceView still starts out being 2392px wide and inside my native Init function, orxViewport_GetSize still reports a width of 2392!
Another oddity I've noticed while working on this issue is that the margin magically disappeared on a random run (without the MyTheme trick). I couldn't replicate that run, but I'm definitely sure that it happened. My guess is that on that particular run, the starting of the orx thread was delayed just enough to catch the correct SurfaceView size.
Another important thing to note is when I set the orientation of the activity to be portrait, I get those same margins at the top and bottom (so they're physically at the same place)
My feeling about all this and the magic 2392 number is that just when the activity is first created, Android adjusts the view sizes taking into account a title bar, or maybe a status bar, but then it immediately removes it, which is already too late for the orx thread by that time.
I'd be glad if you could give me a hint about what might be going on, and how I might debug/fix it.