mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
Calling love.window.setMode with fullscreen=true and a width or height larger than the largest fullscreen mode now falls back to the largest fullscreen mode instead of failing and returning false.
This commit is contained in:
@@ -98,11 +98,20 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
else
|
||||
{
|
||||
sdlflags |= SDL_WINDOW_FULLSCREEN;
|
||||
SDL_DisplayMode mode = {0, width, height, 0, 0};
|
||||
|
||||
// Fullscreen window creation will bug out if no mode can be used.
|
||||
SDL_DisplayMode mode = {0, width, height, 0, 0};
|
||||
if (SDL_GetClosestDisplayMode(f.display, &mode, &mode) == 0)
|
||||
return false;
|
||||
if (SDL_GetClosestDisplayMode(f.display, &mode, &mode) == nullptr)
|
||||
{
|
||||
// GetClosestDisplayMode will fail if we request a size larger
|
||||
// than the largest available display mode, so we'll try to use
|
||||
// the largest (first) mode in that case.
|
||||
if (SDL_GetDisplayMode(f.display, 0, &mode) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
width = mode.w;
|
||||
height = mode.h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user