From ad698b2c268d7a34317002c9d16a66be9cbf3b4c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 17 Dec 2006 06:47:57 +0000 Subject: [PATCH] split out MakeLoadingWindow --- .../src/arch/LoadingWindow/LoadingWindow.cpp | 85 +++++++++++++++++++ stepmania/src/arch/arch.cpp | 55 ------------ 2 files changed, 85 insertions(+), 55 deletions(-) create mode 100644 stepmania/src/arch/LoadingWindow/LoadingWindow.cpp diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp new file mode 100644 index 0000000000..1c187ee170 --- /dev/null +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp @@ -0,0 +1,85 @@ +#include "global.h" +#include "LoadingWindow.h" +#include "PrefsManager.h" +#include "RageLog.h" +#include "arch/arch_default.h" + +LoadingWindow *MakeLoadingWindow() +{ + if( !PREFSMAN->m_bShowLoadingWindow ) + return new LoadingWindow_Null; +#if defined(LINUX) && !defined(HAVE_GTK) + return new LoadingWindow_Null; +#endif + /* Don't load NULL by default. */ + const RString drivers = "xbox,win32,cocoa,gtk"; + vector DriversToTry; + split( drivers, ",", DriversToTry, true ); + + ASSERT( DriversToTry.size() != 0 ); + + RString Driver; + LoadingWindow *ret = NULL; + + for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i ) + { + Driver = DriversToTry[i]; + +#ifdef USE_LOADING_WINDOW_COCOA + if( !DriversToTry[i].CompareNoCase("Cocoa") ) ret = new LoadingWindow_Cocoa; +#endif +#ifdef USE_LOADING_WINDOW_GTK + if( !DriversToTry[i].CompareNoCase("Gtk") ) ret = new LoadingWindow_Gtk; +#endif +#ifdef USE_LOADING_WINDOW_NULL + if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null; +#endif +#ifdef USE_LOADING_WINDOW_WIN32 + if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32; +#endif +#ifdef USE_LOADING_WINDOW_XBOX + if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox; +#endif + + + if( ret == NULL ) + continue; + + RString sError = ret->Init(); + if( sError != "" ) + { + LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() ); + SAFE_DELETE( ret ); + } + } + + if(ret) + LOG->Info( "Loading window: %s", Driver.c_str() ); + + return ret; +} + +/* + * (c) 2002-2005 Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp index 41b3439482..16f08d8e83 100644 --- a/stepmania/src/arch/arch.cpp +++ b/stepmania/src/arch/arch.cpp @@ -12,61 +12,6 @@ #include "arch_default.h" -LoadingWindow *MakeLoadingWindow() -{ - if( !PREFSMAN->m_bShowLoadingWindow ) - return new LoadingWindow_Null; -#if defined(LINUX) && !defined(HAVE_GTK) - return new LoadingWindow_Null; -#endif - /* Don't load NULL by default. */ - const RString drivers = "xbox,win32,cocoa,gtk"; - vector DriversToTry; - split( drivers, ",", DriversToTry, true ); - - ASSERT( DriversToTry.size() != 0 ); - - RString Driver; - LoadingWindow *ret = NULL; - - for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i ) - { - Driver = DriversToTry[i]; - -#ifdef USE_LOADING_WINDOW_COCOA - if( !DriversToTry[i].CompareNoCase("Cocoa") ) ret = new LoadingWindow_Cocoa; -#endif -#ifdef USE_LOADING_WINDOW_GTK - if( !DriversToTry[i].CompareNoCase("Gtk") ) ret = new LoadingWindow_Gtk; -#endif -#ifdef USE_LOADING_WINDOW_NULL - if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null; -#endif -#ifdef USE_LOADING_WINDOW_WIN32 - if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32; -#endif -#ifdef USE_LOADING_WINDOW_XBOX - if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox; -#endif - - - if( ret == NULL ) - continue; - - RString sError = ret->Init(); - if( sError != "" ) - { - LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() ); - SAFE_DELETE( ret ); - } - } - - if(ret) - LOG->Info( "Loading window: %s", Driver.c_str() ); - - return ret; -} - MemoryCardDriver *MakeMemoryCardDriver() { MemoryCardDriver *ret = NULL;