split out SetupSDL

This commit is contained in:
Glenn Maynard
2004-06-14 05:18:09 +00:00
parent 7fd8f3d3cc
commit e534493c42
3 changed files with 19 additions and 7 deletions
+13
View File
@@ -335,6 +335,19 @@ void SDL_UpdateHWnd()
#endif #endif
} }
void SetupSDL()
{
static bool bDone = false;
if( bDone )
return;
bDone = true;
/* Start SDL (with no subsystems), to make sure we don't use SDL's error handler. */
SDL_Init( SDL_INIT_NOPARACHUTE );
/* Clean up on exit. */
atexit( SDL_Quit );
}
/* /*
* (c) 2002-2004 Glenn Maynard * (c) 2002-2004 Glenn Maynard
+2
View File
@@ -33,6 +33,8 @@ RageSurface *RageSurfaceFromSDLSurface( SDL_Surface *surf );
void SDL_UpdateHWnd(); void SDL_UpdateHWnd();
void SetupSDL();
#endif #endif
/* /*
+4 -7
View File
@@ -968,15 +968,13 @@ int main(int argc, char* argv[])
PREFSMAN->ReadGlobalPrefsFromDisk(); PREFSMAN->ReadGlobalPrefsFromDisk();
ApplyLogPreferences(); ApplyLogPreferences();
atexit(SDL_Quit); /* Clean up on exit */ #if defined(HAVE_SDL)
SetupSDL();
#endif
/* This should be done after PREFSMAN is set up, so it can use Dialog::OK(). */ /* This should be done after PREFSMAN is set up, so it can use Dialog::OK(). */
Dialog::Init(); Dialog::Init();
/* Fire up the SDL, but don't actually start any subsystems.
* We use our own error handlers. */
SDL_Init( SDL_INIT_NOPARACHUTE );
// //
// Create game objects // Create game objects
// //
@@ -1067,8 +1065,7 @@ int main(int argc, char* argv[])
SONGMAN->PreloadSongImages(); SONGMAN->PreloadSongImages();
/* This initializes objects that change the SDL event mask, and has other /* This initializes objects that change the SDL event mask, and has other
* dependencies on the SDL video subsystem, so it must be initialized after * dependencies on the SDL video subsystem, so it must be initialized after DISPLAY. */
* DISPLAY and setting the default SDL event mask. */
INPUTMAN = new RageInput; INPUTMAN = new RageInput;
// These things depend on the TextureManager, so do them after! // These things depend on the TextureManager, so do them after!