Browse Source

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

Alex Szpakowski 11 years ago
parent
commit
c985b1f2f7
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/modules/window/sdl/Window.cpp

+ 6 - 4
src/modules/window/sdl/Window.cpp

@@ -70,10 +70,6 @@ Window::_currentMode::_currentMode()
 
 
 bool Window::setWindow(int width, int height, WindowSettings *settings)
 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;
 	WindowSettings f;
 
 
 	if (settings)
 	if (settings)
@@ -122,6 +118,10 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 		sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
 		sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
 #endif
 #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.
 	// Destroy and recreate the window if the dimensions or flags have changed.
 	if (window)
 	if (window)
 	{
 	{
@@ -155,6 +155,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 
 
 	if (!window)
 	if (!window)
 	{
 	{
+		created = false;
+
 		// In Windows and Linux, some GL attributes are set on window creation.
 		// In Windows and Linux, some GL attributes are set on window creation.
 		setWindowGLAttributes(f.fsaa, f.sRGB);
 		setWindowGLAttributes(f.fsaa, f.sRGB);