Changeset - r12925:90ba6b12158c
[Not reviewed]
master
0 20 0
rubidium - 15 years ago 2009-09-05 21:26:51
rubidium@openttd.org
(svn r17428) -Codechange: add a function to get the name of a driver
20 files changed with 21 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/driver.h
Show inline comments
 
@@ -27,24 +27,26 @@ public:
 

	
 
	virtual void Stop() = 0;
 

	
 
	virtual ~Driver() { }
 

	
 
	enum Type {
 
		DT_BEGIN = 0,
 
		DT_SOUND = 0,
 
		DT_MUSIC,
 
		DT_VIDEO,
 
		DT_END,
 
	};
 

	
 
	virtual const char *GetName() const = 0;
 
};
 

	
 
DECLARE_POSTFIX_INCREMENT(Driver::Type);
 

	
 

	
 
class DriverFactoryBase {
 
private:
 
	Driver::Type type;
 
	const char *name;
 
	int priority;
 

	
 
	typedef std::map<const char *, DriverFactoryBase *, StringCompare> Drivers;
src/music/allegro_m.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_Allegro: public MusicD
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
};
 

	
 
class FMusicDriver_Allegro: public MusicDriverFactory<FMusicDriver_Allegro> {
 
public:
 
	static const int priority = 1;
 
	/* virtual */ const char *GetName() { return "allegro"; }
 
	/* virtual */ const char *GetDescription() { return "Allegro MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_Allegro(); }
 
};
 

	
 
#endif /* MUSIC_ALLEGRO_H */
src/music/bemidi.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_BeMidi: public MusicDr
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "bemidi"; }
 
};
 

	
 
class FMusicDriver_BeMidi: public MusicDriverFactory<FMusicDriver_BeMidi> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "bemidi"; }
 
	/* virtual */ const char *GetDescription() { return "BeOS MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_BeMidi(); }
 
};
 

	
 
#endif /* MUSIC_BEMIDI_H */
src/music/dmusic.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_DMusic: public MusicDr
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "dmusic"; }
 
};
 

	
 
class FMusicDriver_DMusic: public MusicDriverFactory<FMusicDriver_DMusic> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "dmusic"; }
 
	/* virtual */ const char *GetDescription() { return "DirectMusic MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_DMusic(); }
 
};
 

	
 
#endif /* MUSIC_DMUSIC_H */
src/music/extmidi.h
Show inline comments
 
@@ -26,23 +26,24 @@ private:
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "extmidi"; }
 
};
 

	
 
class FMusicDriver_ExtMidi: public MusicDriverFactory<FMusicDriver_ExtMidi> {
 
public:
 
	static const int priority = 1;
 
	/* virtual */ const char *GetName() { return "extmidi"; }
 
	/* virtual */ const char *GetDescription() { return "External MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_ExtMidi(); }
 
};
 

	
 
#endif /* MUSIC_EXTERNAL_H */
src/music/libtimidity.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_LibTimidity: public Mu
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "libtimidity"; }
 
};
 

	
 
class FMusicDriver_LibTimidity: public MusicDriverFactory<FMusicDriver_LibTimidity> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "libtimidity"; }
 
	/* virtual */ const char *GetDescription() { return "LibTimidity MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_LibTimidity(); }
 
};
 

	
 
#endif /* MUSIC_LIBTIMIDITY_H */
src/music/null_m.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_Null: public MusicDriv
 
public:
 
	/* virtual */ const char *Start(const char * const *param) { return NULL; }
 

	
 
	/* virtual */ void Stop() { }
 

	
 
	/* virtual */ void PlaySong(const char *filename) { }
 

	
 
	/* virtual */ void StopSong() { }
 

	
 
	/* virtual */ bool IsSongPlaying() { return true; }
 

	
 
	/* virtual */ void SetVolume(byte vol) { }
 
	/* virtual */ const char *GetName() const { return "null"; }
 
};
 

	
 
class FMusicDriver_Null: public MusicDriverFactory<FMusicDriver_Null> {
 
public:
 
	static const int priority = 0;
 
	/* virtual */ const char *GetName() { return "null"; }
 
	/* virtual */ const char *GetDescription() { return "Null Music Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_Null(); }
 
};
 

	
 
#endif /* MUSIC_NULL_H */
src/music/os2_m.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_OS2: public MusicDrive
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "os2"; }
 
};
 

	
 
class FMusicDriver_OS2: public MusicDriverFactory<FMusicDriver_OS2> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "os2"; }
 
	/* virtual */ const char *GetDescription() { return "OS/2 Music Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_OS2(); }
 
};
 

	
 
#endif /* MUSIC_OS2_H */
src/music/qtmidi.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_QtMidi: public MusicDr
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "qt"; }
 
};
 

	
 
class FMusicDriver_QtMidi: public MusicDriverFactory<FMusicDriver_QtMidi> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "qt"; }
 
	/* virtual */ const char *GetDescription() { return "QuickTime MIDI Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_QtMidi(); }
 
};
 

	
 
#endif /* MUSIC_MACOSX_QUICKTIME_H */
src/music/win32_m.h
Show inline comments
 
@@ -18,23 +18,24 @@ class MusicDriver_Win32: public MusicDri
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void PlaySong(const char *filename);
 

	
 
	/* virtual */ void StopSong();
 

	
 
	/* virtual */ bool IsSongPlaying();
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
};
 

	
 
class FMusicDriver_Win32: public MusicDriverFactory<FMusicDriver_Win32> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "win32"; }
 
	/* virtual */ const char *GetDescription() { return "Win32 Music Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new MusicDriver_Win32(); }
 
};
 

	
 
#endif /* MUSIC_WIN32_H */
src/sound/allegro_s.h
Show inline comments
 
@@ -12,23 +12,24 @@
 
#ifndef SOUND_ALLEGRO_H
 
#define SOUND_ALLEGRO_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_Allegro: public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MainLoop();
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
};
 

	
 
class FSoundDriver_Allegro: public SoundDriverFactory<FSoundDriver_Allegro> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "allegro"; }
 
	/* virtual */ const char *GetDescription() { return "Allegro Sound Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new SoundDriver_Allegro(); }
 
};
 

	
 
#endif /* SOUND_ALLEGRO_H */
src/sound/cocoa_s.h
Show inline comments
 
@@ -10,23 +10,24 @@
 
/** @file cocoa_s.h Base for Cocoa sound handling. */
 

	
 
#ifndef SOUND_COCOA_H
 
#define SOUND_COCOA_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_Cocoa: public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "cocoa"; }
 
};
 

	
 
class FSoundDriver_Cocoa: public SoundDriverFactory<FSoundDriver_Cocoa> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "cocoa"; }
 
	/* virtual */ const char *GetDescription() { return "Cocoa Sound Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new SoundDriver_Cocoa(); }
 
};
 

	
 
#endif /* SOUND_COCOA_H */
src/sound/null_s.h
Show inline comments
 
@@ -10,23 +10,24 @@
 
/** @file null_s.h Base for the sound of silence. */
 

	
 
#ifndef SOUND_NULL_H
 
#define SOUND_NULL_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_Null: public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param) { return NULL; }
 

	
 
	/* virtual */ void Stop() { }
 
	/* virtual */ const char *GetName() const { return "null"; }
 
};
 

	
 
class FSoundDriver_Null: public SoundDriverFactory<FSoundDriver_Null> {
 
public:
 
	static const int priority = 0;
 
	/* virtual */ const char *GetName() { return "null"; }
 
	/* virtual */ const char *GetDescription() { return "Null Sound Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new SoundDriver_Null(); }
 
};
 

	
 
#endif /* SOUND_NULL_H */
src/sound/sdl_s.h
Show inline comments
 
@@ -10,23 +10,24 @@
 
/** @file sdl_s.h Base fo playing sound via SDL. */
 

	
 
#ifndef SOUND_SDL_H
 
#define SOUND_SDL_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_SDL: public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "sdl"; }
 
};
 

	
 
class FSoundDriver_SDL: public SoundDriverFactory<FSoundDriver_SDL> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "sdl"; }
 
	/* virtual */ const char *GetDescription() { return "SDL Sound Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new SoundDriver_SDL(); }
 
};
 

	
 
#endif /* SOUND_SDL_H */
src/sound/win32_s.h
Show inline comments
 
@@ -10,23 +10,24 @@
 
/** @file win32_s.h Base for Windows sound handling. */
 

	
 
#ifndef SOUND_WIN32_H
 
#define SOUND_WIN32_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_Win32: public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
};
 

	
 
class FSoundDriver_Win32: public SoundDriverFactory<FSoundDriver_Win32> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "win32"; }
 
	/* virtual */ const char *GetDescription() { return "Win32 WaveOut Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new SoundDriver_Win32(); }
 
};
 

	
 
#endif /* SOUND_WIN32_H */
src/video/allegro_v.h
Show inline comments
 
@@ -18,23 +18,24 @@ class VideoDriver_Allegro: public VideoD
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 

	
 
	/* virtual */ void MainLoop();
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
};
 

	
 
class FVideoDriver_Allegro: public VideoDriverFactory<FVideoDriver_Allegro> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "allegro"; }
 
	/* virtual */ const char *GetDescription() { return "Allegro Video Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new VideoDriver_Allegro(); }
 
};
 

	
 
#endif /* VIDEO_ALLEGRO_H */
src/video/dedicated_v.h
Show inline comments
 
@@ -18,24 +18,25 @@ class VideoDriver_Dedicated: public Vide
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 

	
 
	/* virtual */ void MainLoop();
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "dedicated"; }
 
};
 

	
 
class FVideoDriver_Dedicated: public VideoDriverFactory<FVideoDriver_Dedicated> {
 
public:
 
#ifdef DEDICATED
 
	/* Automatically select this dedicated driver when making a dedicated
 
	 * server build. */
 
	static const int priority = 10;
 
#else
 
	static const int priority = 0;
 
#endif
 
	/* virtual */ const char *GetName() { return "dedicated"; }
src/video/null_v.h
Show inline comments
 
@@ -21,23 +21,24 @@ private:
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 

	
 
	/* virtual */ void MainLoop();
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "null"; }
 
};
 

	
 
class FVideoDriver_Null: public VideoDriverFactory<FVideoDriver_Null> {
 
public:
 
	static const int priority = 0;
 
	/* virtual */ const char *GetName() { return "null"; }
 
	/* virtual */ const char *GetDescription() { return "Null Video Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new VideoDriver_Null(); }
 
};
 

	
 
#endif /* VIDEO_NULL_H */
src/video/sdl_v.h
Show inline comments
 
@@ -18,23 +18,24 @@ class VideoDriver_SDL: public VideoDrive
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 

	
 
	/* virtual */ void MainLoop();
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "sdl"; }
 
};
 

	
 
class FVideoDriver_SDL: public VideoDriverFactory<FVideoDriver_SDL> {
 
public:
 
	static const int priority = 5;
 
	/* virtual */ const char *GetName() { return "sdl"; }
 
	/* virtual */ const char *GetDescription() { return "SDL Video Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new VideoDriver_SDL(); }
 
};
 

	
 
#endif /* VIDEO_SDL_H */
src/video/win32_v.h
Show inline comments
 
@@ -18,23 +18,24 @@ class VideoDriver_Win32: public VideoDri
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 

	
 
	/* virtual */ void MainLoop();
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
};
 

	
 
class FVideoDriver_Win32: public VideoDriverFactory<FVideoDriver_Win32> {
 
public:
 
	static const int priority = 10;
 
	/* virtual */ const char *GetName() { return "win32"; }
 
	/* virtual */ const char *GetDescription() { return "Win32 GDI Video Driver"; }
 
	/* virtual */ Driver *CreateInstance() { return new VideoDriver_Win32(); }
 
};
 

	
 
#endif /* VIDEO_WIN32_H */
0 comments (0 inline, 0 general)