Force landscape orientation and hide title bar on Android

Always force landscape orientation to be used for the game on Android.

Hide the title bar so it is not shown when starting the game. There is also a bug with SDL currently that leads to the title bar and status bar being shown permanently after minimizing and reopening the app, which is alleviated by hiding the title bar.
This commit is contained in:
Robert Müller 2024-05-19 12:58:33 +02:00
parent 85b00ba7c1
commit 05c825947a
2 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,8 @@
package="tw.DDNet">
<uses-feature
android:glEsVersion="0x00030000" />
<uses-feature
android:name="android.hardware.screen.landscape" />
<!-- Teeworlds does broadcasts over local networks -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
@ -24,10 +26,11 @@
android:isGame="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
>
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity
android:name=".NativeMain"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View file

@ -4529,6 +4529,8 @@ int main(int argc, const char **argv)
// Trap the Android back button so it can be handled in our code reliably
// instead of letting the system handle it.
SDL_SetHint("SDL_ANDROID_TRAP_BACK_BUTTON", "1");
// Force landscape screen orientation.
SDL_SetHint("SDL_IOS_ORIENTATIONS", "LandscapeLeft LandscapeRight");
#endif
// init SDL