mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Android: Fix changing orientation with t.window.fullscreen = true
Fixes love2d/love-android#196
This commit is contained in:
@@ -440,8 +440,16 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
|
|
||||||
Uint32 sdlflags = SDL_WINDOW_OPENGL;
|
Uint32 sdlflags = SDL_WINDOW_OPENGL;
|
||||||
|
|
||||||
// On Android we always must have fullscreen type FULLSCREEN_TYPE_DESKTOP
|
// On Android, disable fullscreen first on window creation so it's
|
||||||
|
// possible to change the orientation by specifying portait width and
|
||||||
|
// height, otherwise SDL will pick the current orientation dimensions when
|
||||||
|
// fullscreen flag is set. Don't worry, we'll set it back later when user
|
||||||
|
// also requested fullscreen after the window is created.
|
||||||
|
// See https://github.com/love2d/love-android/issues/196
|
||||||
#ifdef LOVE_ANDROID
|
#ifdef LOVE_ANDROID
|
||||||
|
bool fullscreen = f.fullscreen;
|
||||||
|
|
||||||
|
f.fullscreen = false;
|
||||||
f.fstype = FULLSCREEN_DESKTOP;
|
f.fstype = FULLSCREEN_DESKTOP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -527,8 +535,11 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
graphics->setMode((int) scaledw, (int) scaledh, pixelWidth, pixelHeight, f.stencil);
|
graphics->setMode((int) scaledw, (int) scaledh, pixelWidth, pixelHeight, f.stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set fullscreen when user requested it before.
|
||||||
|
// See above for explanation.
|
||||||
#ifdef LOVE_ANDROID
|
#ifdef LOVE_ANDROID
|
||||||
love::android::setImmersive(f.fullscreen);
|
setFullscreen(fullscreen);
|
||||||
|
love::android::setImmersive(fullscreen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user