Make* -> Driver::Create. Having these floating in arch.h isn't

useful; if you create the class, you need the class definition to
free it, and anyone creating a class is probably going to use it,
too.
This commit is contained in:
Glenn Maynard
2006-12-17 08:00:03 +00:00
parent 9b531743fc
commit f2e0053c7d
8 changed files with 11 additions and 6 deletions
+1 -2
View File
@@ -21,7 +21,6 @@
#include "arch/Sound/RageSoundDriver.h" #include "arch/Sound/RageSoundDriver.h"
#include "arch/arch.h"
#include "arch/arch_default.h" #include "arch/arch_default.h"
/* /*
@@ -52,7 +51,7 @@ void RageSoundManager::Init()
if( sDrivers.empty() ) if( sDrivers.empty() )
sDrivers = DEFAULT_SOUND_DRIVER_LIST; sDrivers = DEFAULT_SOUND_DRIVER_LIST;
m_pDriver = MakeRageSoundDriver( sDrivers ); m_pDriver = RageSoundDriver::Create( sDrivers );
if( m_pDriver == NULL ) if( m_pDriver == NULL )
RageException::Throw( "%s", COULDNT_FIND_SOUND_DRIVER.GetValue().c_str() ); RageException::Throw( "%s", COULDNT_FIND_SOUND_DRIVER.GetValue().c_str() );
} }
+1 -1
View File
@@ -896,7 +896,7 @@ int main(int argc, char* argv[])
SetCommandlineArguments( argc, argv ); SetCommandlineArguments( argc, argv );
/* Set up arch hooks first. This may set up crash handling. */ /* Set up arch hooks first. This may set up crash handling. */
HOOKS = MakeArchHooks(); HOOKS = ArchHooks::Create();
HOOKS->Init(); HOOKS->Init();
#if !defined(DEBUG) #if !defined(DEBUG)
/* Tricky: for other exceptions, we want a backtrace. To do this in Windows, /* Tricky: for other exceptions, we want a backtrace. To do this in Windows,
+1 -1
View File
@@ -50,7 +50,7 @@ bool ArchHooks::GoToURL( RString sUrl )
return false; return false;
} }
ArchHooks *MakeArchHooks() ArchHooks *ArchHooks::Create()
{ {
return new ARCH_HOOKS; return new ARCH_HOOKS;
} }
+2
View File
@@ -4,6 +4,8 @@
class ArchHooks class ArchHooks
{ {
public: public:
static ArchHooks *Create();
ArchHooks(): m_bHasFocus(true), m_bFocusChanged(false) { } ArchHooks(): m_bHasFocus(true), m_bFocusChanged(false) { }
virtual ~ArchHooks() { } virtual ~ArchHooks() { }
virtual void Init() { } virtual void Init() { }
@@ -77,7 +77,7 @@ static Preference<RString> g_sMovieDrivers( "MovieDrivers", "" ); // "" == defau
/* Try drivers in order of preference until we find one that works. */ /* Try drivers in order of preference until we find one that works. */
static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." );
static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." );
RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) RageMovieTexture *RageMovieTexture::Create( RageTextureID ID )
{ {
DumpAVIDebugInfo( ID.filename ); DumpAVIDebugInfo( ID.filename );
@@ -8,6 +8,8 @@
class RageMovieTexture : public RageTexture class RageMovieTexture : public RageTexture
{ {
public: public:
static RageMovieTexture *Create( RageTextureID ID );
RageMovieTexture( RageTextureID ID ): RageTexture(ID) { } RageMovieTexture( RageTextureID ID ): RageTexture(ID) { }
virtual ~RageMovieTexture() { } virtual ~RageMovieTexture() { }
virtual void Update( float fDeltaTime ) { } virtual void Update( float fDeltaTime ) { }
+1 -1
View File
@@ -11,7 +11,7 @@ RegisterSoundDriver::RegisterSoundDriver( const istring &sName, CreateRageDriver
g_pRegistrees.Add( sName, pfn ); g_pRegistrees.Add( sName, pfn );
} }
RageSoundDriver *MakeRageSoundDriver( const RString &drivers ) RageSoundDriver *RageSoundDriver::Create( const RString &drivers )
{ {
vector<RString> DriversToTry; vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true ); split( drivers, ",", DriversToTry, true );
@@ -8,6 +8,8 @@ class RageSoundBase;
class RageSoundDriver: public RageDriver class RageSoundDriver: public RageDriver
{ {
public: public:
static RageSoundDriver *Create( const RString &sDrivers );
friend class RageSoundManager; friend class RageSoundManager;
/* Initialize. On failure, an error message is returned. */ /* Initialize. On failure, an error message is returned. */