]> git.jsancho.org Git - lugaru.git/commitdiff
Try fallbacks if we can't set video mode.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 8 Nov 2009 07:56:14 +0000 (02:56 -0500)
committerRyan C. Gordon <icculus@icculus.org>
Sun, 8 Nov 2009 07:56:14 +0000 (02:56 -0500)
Source/OpenGL_Windows.cpp

index 2efaac415be6bcf6fdc188de8a408bd63ad35fee..2937fefc3948994ab0af8bd9aaf803c729c209c5 100644 (file)
@@ -887,7 +887,20 @@ Boolean SetUp (Game & game)
     if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL)
     {
         fprintf(stderr, "SDL_SetVideoMode() failed: %s\n", SDL_GetError());
-        return false;
+        fprintf(stderr, "forcing 640x480...\n");
+        kContextWidth = 640;
+        kContextHeight = 480;
+        if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL)
+        {
+            fprintf(stderr, "SDL_SetVideoMode() failed: %s\n", SDL_GetError());
+            fprintf(stderr, "forcing 640x480 windowed mode...\n");
+            sdlflags &= ~SDL_FULLSCREEN;
+            if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL)
+            {
+                fprintf(stderr, "SDL_SetVideoMode() failed: %s\n", SDL_GetError());
+                return false;
+            }
+        }
     }
 
     if (!lookup_all_glsyms())