Handling orientation on Android.

This commit is contained in:
Pere Pujal i Carabantes 2019-11-02 01:00:16 +01:00
parent 6e1b801de2
commit 4e4a6e569d

View file

@ -24044,12 +24044,25 @@ static void setup(void)
/* Deal with orientation rotation option */ /* Deal with orientation rotation option */
#if defined __ANDROID__
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeRight");
#endif
if (rotate_orientation) if (rotate_orientation)
{ {
if (native_screensize && fullscreen) if (native_screensize && fullscreen)
{ {
#if defined __ANDROID__
/* FIXME 2019-11-02: Could this work on every device instead of just Android ones? */
SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait");
int tmp;
tmp = WINDOW_WIDTH;
WINDOW_WIDTH = WINDOW_HEIGHT;
WINDOW_HEIGHT = tmp;
#else
fprintf(stderr, "Warning: Asking for native screen size overrides request to rotate orientation.\n"); fprintf(stderr, "Warning: Asking for native screen size overrides request to rotate orientation.\n");
#endif
} }
else else
{ {