Skip to content

Commit 4a952ad

Browse files
committed
fix(android): force landscape from launch
WackiActivity was already sensorLandscape, but SetupActivity (the launcher) had no orientation, so the app opened in the system orientation (often portrait) before the game flipped to landscape. Force sensorLandscape on SetupActivity too, and set SDL_HINT_ORIENTATIONS to landscape-only in the Android early-init so SDL's runtime orientation pick can't request portrait. The app is now landscape from the first frame.
1 parent 1e49cf7 commit 4a952ad

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
android:name=".SetupActivity"
2323
android:exported="true"
2424
android:theme="@android:style/Theme.Material.Light"
25+
android:screenOrientation="sensorLandscape"
2526
android:configChanges="orientation|screenSize|keyboardHidden">
2627
<intent-filter>
2728
<action android:name="android.intent.action.MAIN" />

src/platform/sdl/system_sdl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ void plat_system_early_init(void)
6969
if (home && chdir(home) == 0)
7070
LOG_INFO("platform", "user dir: %s", home);
7171
SDL_SetHint(SDL_HINT_ANDROID_TRAP_BACK_BUTTON, "1");
72+
/* Lock to landscape. The manifest already forces it per-activity; this
73+
* pins SDL's own runtime orientation pick (it sets the activity's
74+
* requested orientation when the 640×480 window is created) to landscape
75+
* only, so a device held in portrait never flashes/rotates the game. */
76+
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");
7277
#endif
7378
}
7479

0 commit comments

Comments
 (0)