In the Android project, the game's Android.App.ActivityAttribute.ScreenOrientation property, and the RequestedOrientation property in the AndroidGameActivity.OnCreate method, have no effect on screen orientation.
Essentially, after debugging, I found that they actually all execute as expected. However, SDL exhibits an unexpected behavior (at least for me, as I couldn't find any mention in o!f documentation, nor any usage examples or comments in osu!) where if SDL_HINT_ORIENTATIONS is not assigned any valid value, SDLActivity will assign a default value for orientation, which is typically FullUser. This assignment occurs after OnCreate, thus overriding any previous assignments.
Specifically, this process is initiated by the SDL3Window.Create() method.
A viable solution is to add such a call in the OnCreate method:
SDL.SDL3.SDL_SetHint(SDL.SDL3.SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight"u8);
However, it's clear that we cannot assign arbitrary desired values, such as Nosensor, to the program via the SDL_HINT_ORIENTATIONS.
Furthermore, mixing SDL mode declarations in MAUI might lead to some unexpected side effects, which I will describe in a subsequent issue.
And frankly, this approach seems somewhat counter-intuitive and ugly.
In the Android project, the game's
Android.App.ActivityAttribute.ScreenOrientationproperty, and theRequestedOrientationproperty in theAndroidGameActivity.OnCreatemethod, have no effect on screen orientation.Essentially, after debugging, I found that they actually all execute as expected. However, SDL exhibits an unexpected behavior (at least for me, as I couldn't find any mention in o!f documentation, nor any usage examples or comments in osu!) where if
SDL_HINT_ORIENTATIONSis not assigned any valid value,SDLActivitywill assign a default value for orientation, which is typicallyFullUser. This assignment occurs afterOnCreate, thus overriding any previous assignments.Specifically, this process is initiated by the
SDL3Window.Create()method.A viable solution is to add such a call in the
OnCreatemethod:However, it's clear that we cannot assign arbitrary desired values, such as
Nosensor, to the program via theSDL_HINT_ORIENTATIONS.Furthermore, mixing SDL mode declarations in MAUI might lead to some unexpected side effects, which I will describe in a subsequent issue.
And frankly, this approach seems somewhat counter-intuitive and ugly.