cf8e93c
diff -up BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp.fs BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp
cf8e93c
--- BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp.fs	2007-08-02 15:44:10.000000000 +0200
cf8e93c
+++ BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp	2007-11-30 20:46:53.000000000 +0100
cf8e93c
@@ -20,30 +20,8 @@ GLApplication::GLApplication() {
cf8e93c
 
cf8e93c
 int GLApplication::ToggleFullscreen() {
cf8e93c
 
cf8e93c
-  int errCode;
cf8e93c
-
cf8e93c
-  InvalidateDeviceObjects();
cf8e93c
-
cf8e93c
-  m_bWindowed = !m_bWindowed;
cf8e93c
-
cf8e93c
-  Uint32 flags;
cf8e93c
-  if( m_bWindowed ) flags = SDL_OPENGL;
cf8e93c
-  else              flags = SDL_OPENGL | SDL_FULLSCREEN;
cf8e93c
-
cf8e93c
-  if( SDL_SetVideoMode( m_screenWidth, m_screenHeight, 0, flags ) == NULL )
cf8e93c
-  {
cf8e93c
-    printf("SDL_SetVideoMode() failed.\n");
cf8e93c
-    return GL_FAIL;
cf8e93c
-  }
cf8e93c
-
cf8e93c
-  SDL_Surface *vSurf = SDL_GetVideoSurface();
cf8e93c
-  m_bitsPerPixel = vSurf->format->BitsPerPixel;
cf8e93c
-
cf8e93c
-  errCode = RestoreDeviceObjects();
cf8e93c
-	if( !errCode ) {
cf8e93c
-		printGlError();
cf8e93c
-		exit(1);
cf8e93c
-	}
cf8e93c
+  if (SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()))
cf8e93c
+    m_bWindowed = !m_bWindowed;
cf8e93c
 
cf8e93c
   return GL_OK;
cf8e93c
     
cf8e93c
@@ -69,6 +47,8 @@ int GLApplication::Create(int width, int
cf8e93c
     printf("SDL_Init() failed : %s\n" , SDL_GetError() );
cf8e93c
     return GL_FAIL;    
cf8e93c
   }
cf8e93c
+  
cf8e93c
+  atexit(SDL_Quit);
cf8e93c
 
cf8e93c
   //SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
cf8e93c
   SDL_EnableUNICODE( 1 );
cf8e93c
diff -up BlockOutII-2.3/BlockOut_GL/BlockOut.cpp.fs BlockOutII-2.3/BlockOut_GL/BlockOut.cpp
cf8e93c
--- BlockOutII-2.3/BlockOut_GL/BlockOut.cpp.fs	2007-08-02 15:44:09.000000000 +0200
cf8e93c
+++ BlockOutII-2.3/BlockOut_GL/BlockOut.cpp	2007-11-30 20:44:24.000000000 +0100
cf8e93c
@@ -120,7 +120,7 @@ int BlockOut::FrameMove()
cf8e93c
           break;
cf8e93c
         case 100: // Exit
cf8e93c
           InvalidateDeviceObjects();
cf8e93c
-          _exit(0);
cf8e93c
+          exit(0);
cf8e93c
           break;
cf8e93c
       }
cf8e93c
       break;