Don't destroy OpenGL resources before checking whether the fullscreen size is supported in love.window.setMode.

This commit is contained in:
Alex Szpakowski
2014-03-31 05:01:29 -03:00
parent be8c19911f
commit c985b1f2f7
+6 -4
View File
@@ -70,10 +70,6 @@ Window::_currentMode::_currentMode()
bool Window::setWindow(int width, int height, WindowSettings *settings)
{
graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics.");
if (gfx != nullptr)
gfx->unSetMode();
WindowSettings f;
if (settings)
@@ -122,6 +118,10 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif
graphics::Graphics *gfx = (graphics::Graphics *) Module::findInstance("love.graphics.");
if (gfx != nullptr)
gfx->unSetMode();
// Destroy and recreate the window if the dimensions or flags have changed.
if (window)
{
@@ -155,6 +155,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
if (!window)
{
created = false;
// In Windows and Linux, some GL attributes are set on window creation.
setWindowGLAttributes(f.fsaa, f.sRGB);