2005-12-18 18:37:03 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2013-01-04 19:49:01 +00:00
|
|
|
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2005-12-18 18:37:03 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2005-12-18 18:37:03 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2005-12-18 18:37:03 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef MEDIA_FACTORY_HXX
|
|
|
|
#define MEDIA_FACTORY_HXX
|
|
|
|
|
2013-02-10 21:47:47 +00:00
|
|
|
#include "OSystem.hxx"
|
|
|
|
#include "Settings.hxx"
|
|
|
|
|
|
|
|
#include "FrameBuffer.hxx"
|
|
|
|
#include "FrameBufferSoft.hxx"
|
|
|
|
#ifdef DISPLAY_OPENGL
|
|
|
|
#include "FrameBufferGL.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Sound.hxx"
|
|
|
|
#ifdef SOUND_SUPPORT
|
|
|
|
#include "SoundSDL.hxx"
|
|
|
|
#else
|
|
|
|
#include "SoundNull.hxx"
|
|
|
|
#endif
|
2005-12-18 18:37:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This class deals with the different framebuffer/sound implementations
|
|
|
|
for the various ports of Stella, and always returns a valid media object
|
|
|
|
based on the specific port and restrictions on that port.
|
|
|
|
|
2013-02-10 21:47:47 +00:00
|
|
|
I think you can see why this mess was put into a factory class :)
|
|
|
|
|
2005-12-18 18:37:03 +00:00
|
|
|
@author Stephen Anthony
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2005-12-18 18:37:03 +00:00
|
|
|
*/
|
|
|
|
class MediaFactory
|
|
|
|
{
|
|
|
|
public:
|
2013-02-10 21:47:47 +00:00
|
|
|
static FrameBuffer* createVideo(OSystem* osystem)
|
|
|
|
{
|
|
|
|
FrameBuffer* fb = (FrameBuffer*) NULL;
|
|
|
|
|
|
|
|
// OpenGL mode *may* fail, so we check for it first
|
|
|
|
#ifdef DISPLAY_OPENGL
|
|
|
|
if(osystem->settings().getString("video") == "gl")
|
|
|
|
{
|
|
|
|
const string& gl_lib = osystem->settings().getString("gl_lib");
|
|
|
|
if(FrameBufferGL::loadLibrary(gl_lib))
|
|
|
|
fb = new FrameBufferGL(osystem);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// If OpenGL failed, or if it wasn't requested, create the appropriate
|
|
|
|
// software framebuffer
|
|
|
|
if(!fb)
|
|
|
|
fb = new FrameBufferSoft(osystem);
|
|
|
|
|
|
|
|
// This should never happen
|
|
|
|
assert(fb != NULL);
|
|
|
|
|
|
|
|
return fb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Sound* createAudio(OSystem* osystem)
|
|
|
|
{
|
|
|
|
Sound* sound = (Sound*) NULL;
|
|
|
|
|
|
|
|
#ifdef SOUND_SUPPORT
|
|
|
|
sound = new SoundSDL(osystem);
|
|
|
|
#else
|
|
|
|
sound = new SoundNull(osystem);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return sound;
|
|
|
|
}
|
2005-12-18 18:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|