I have finally started trying Xenorogue on a real Android smartphone. And my first problem was that the game was rendered too small to comfortably tap on a tile with enough precision.
I was using Heaps’s LetterBox
scale mode with a size of 360 × 200 pixels with integer scaling,
because the window on desktop is configured to 720 × 400 pixels
and that mode would double the graphics,
which looked good on my 13” laptop screen.
My Galaxy A13, however, has a resolution of 1080 × 2207 pixels in vertical and 2208 × 1012 pixels in landscape,
because i am not yet running the game in full screen mode and the navigation and status bars use some of the screen’s real state.
With the same LetterBox
as before, Heaps would use a scale of 3 for 1080 × 2207, which is too low.
I changed the scale mode to AutoZoom(180, 0, true)
in vertical and AutoZoom(0, 180, true)
in landscape,
thinking that i would get a scale of six for both orientations.
But i did not:
in landscape the scale ended up being five.
I did not know why.
Therefore, i added a trace
with the screen’s size and stage scale to understand what was going on.
It was easy to see the output of trace
with the desktop version,
because the console only writes the output of my application,
but with Android’ adb logcat
these is a lot of logging statements,
not only from my game but from the whole system.
Fortunately, all Android log statements have a tag and you can just do adb logcat | grep $tag
to reduce the line to what you are interested in.
HashLink, by default, uses the tag hl
,
which is not easy to find,
and is even worse if there are more HashLink applications running on the same phone all using the same tag.
To change this tag,
you must define the preprocessor macro HL_ANDROID_LOG_TAG
with the string you want to use instead.
With ndk-build
, it is only a matter of appending the following to HashLink’s Android.mk
file.
This, however, would mean that all games that use the same Docker image to build on Android would have the same tag. It would be better if every project could set their own tag. Thus, i have added the following step to Xenorogue’s configuration file for GitLab’s CI/CD.
This ed
script looks for the string abiFilter
that starts with one or more spaces,
because SDL’s build.gradle
has many commented out abiFilter
directives,
the a
command tells ed
to start insert mode at the line below (“append”),
.
exits from insert mode,
w
writes the changes to the file,
and q
quits ed
.