rnd-20001206-1-src
[rocksndiamonds.git] / src / libgame / sdl.c
index c9de611ecc61779b5d8a35834040acd8001d6608..a4fbf7dee3d12997c9cc817a21b40507b755d1b9 100644 (file)
 inline void SDLInitVideoDisplay(void)
 {
   /* initialize SDL video */
-  if (SDL_Init(SDL_INIT_VIDEO) < 0)
-    Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
+  if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
+    Error(ERR_EXIT, "SDL_InitSubSystem() failed: %s", SDL_GetError());
 
   /* set default SDL depth */
   video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
-
-  /* set exit function to automatically cleanup SDL stuff after exit() */
-  atexit(SDL_Quit);
 }
 
 inline void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
@@ -710,9 +707,9 @@ Bitmap *SDLLoadImage(char *filename)
 
 inline boolean SDLOpenAudio(void)
 {
-  if (SDL_Init(SDL_INIT_AUDIO) < 0)
+  if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
   {
-    Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError());
+    Error(ERR_WARN, "SDL_InitSubSystem() failed: %s", SDL_GetError());
     return FALSE;
   }