Repository navigation
Android Bindings? #196
|
I saw SDL3-CS.Android has a .jar binding and I wonder if I can modify it, I wanted to remove a section or fix the orientation because I cannot set it to sensorLandscape even after putting it on the manifest, OnCreate, or Main, even with the Landscape SDL hint too |
Replies: 2 comments
|
Hi!
In normal use you should not need to modify the For the orientation issue, the important part is that Android's So for a landscape-only SDL app, set the SDL hint before protected override void Main()
{
SDL.SetHint(SDL.Hints.Orientations, "LandscapeLeft LandscapeRight");
if (!SDL.Init(SDL.InitFlags.Video))
{
SDL.LogError(SDL.LogCategory.System, $"SDL could not initialize: {SDL.GetError()}");
return;
}
// Create your SDL window/renderer here.
}You can also set the same SDL hint from <application ...>
<meta-data
android:name="SDL_ENV.SDL_ORIENTATIONS"
android:value="LandscapeLeft LandscapeRight" />
</application>This is usually better than trying to force One nuance: when SDL sees both I would first try the SDL hint form above. If it still does not behave as expected, please share a small |
|
Both of your suggestion works! So doing it using SensorLandscape is a no go, I'm fine with LandscapeLeft and LandscapeRight for now, since on Auto Rotation it detects them anyway, I guess I was using the wrong SDL Orientation hint when I tried it too, thank you so much! :D |
Hi!
SDL3-CS.Androidincludes two different things:libSDL3.sofor Android ABIs), andSDL3Bridge.jar.In normal use you should not need to modify the
.jardirectly. The usual pattern is to inherit fromOrg.Libsdl.App.SDLActivity, overrideGetLibraries()so SDL loadsSDL3, and run your managed SDL code fromMain().For the orientation issue, the important part is that Android's
sensorLandscapevalue is not an SDL orientation hint value. SDL usesSDL_ORIENTATIONS, which accepts a space-delimited list of these values:So for a…