Removed love.window.checkMode (resolves issue #653, invalidates issue #592).

Also fixed love.window.setMode to fail instead of bug out when trying to set a fullscreen mode which is too large for the monitor.
This commit is contained in:
Alex Szpakowski
2013-09-19 18:13:52 -03:00
parent 74f26160da
commit ffe0485173
12 changed files with 60 additions and 125 deletions
+9 -28
View File
@@ -103,15 +103,16 @@ bool Window::setWindow(int width, int height, WindowFlags *flags)
if (f.fullscreen)
{
switch (f.fstype)
{
case FULLSCREEN_TYPE_NORMAL:
default:
sdlflags |= SDL_WINDOW_FULLSCREEN;
break;
case FULLSCREEN_TYPE_DESKTOP:
if (f.fstype == FULLSCREEN_TYPE_DESKTOP)
sdlflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
break;
else
{
sdlflags |= SDL_WINDOW_FULLSCREEN;
// 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;
}
}
@@ -373,26 +374,6 @@ int Window::getDisplayCount() const
return SDL_GetNumVideoDisplays();
}
bool Window::checkWindowSize(int width, int height, bool fullscreen, int displayindex) const
{
if (fullscreen)
{
SDL_DisplayMode mode = {}, closest = {};
mode.w = width;
mode.h = height;
SDL_GetClosestDisplayMode(displayindex, &mode, &closest);
return (mode.w == closest.w && mode.h == closest.h);
}
else
{
SDL_DisplayMode mode = {};
SDL_GetDesktopDisplayMode(displayindex, &mode);
return (width <= mode.w && height <= mode.h);
}
}
typedef Window::WindowSize WindowSize;
std::vector<WindowSize> Window::getFullscreenSizes(int displayindex) const
-1
View File
@@ -51,7 +51,6 @@ public:
int getDisplayCount() const;
bool checkWindowSize(int width, int height, bool fullscreen, int displayindex) const;
std::vector<WindowSize> getFullscreenSizes(int displayindex) const;
int getWidth() const;