First attempt at adding SDL_VIDEODRIVER support as a commandline option.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@345 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-09-14 16:10:28 +00:00
parent a76e7516a8
commit 03d8c0eab5
2 changed files with 44 additions and 30 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: mainSDL.cxx,v 1.16 2004-08-17 01:17:08 stephena Exp $
// $Id: mainSDL.cxx,v 1.17 2004-09-14 16:10:27 stephena Exp $
//============================================================================
#include <fstream>
@ -824,6 +824,18 @@ int main(int argc, char* argv[])
// Request that the SDL window be centered, if possible
putenv("SDL_VIDEO_CENTERED=1");
// Set the SDL_VIDEODRIVER environment variable, if possible
if(theSettings->getString("video_driver") != "")
{
ostringstream buf;
buf << "SDL_VIDEODRIVER=" << theSettings->getString("video_driver");
putenv((char*) buf.str().c_str());
buf.str("");
buf << "Using SDL video driver = " << theSettings->getString("video_driver") << ".";
ShowInfo(buf.str());
}
// Get a pointer to the file which contains the cartridge ROM
const char* file = argv[argc - 1];
@ -846,20 +858,20 @@ int main(int argc, char* argv[])
if(videodriver == "soft")
{
theDisplay = new FrameBufferSoft();
ShowInfo("Using software mode for video.");
ShowInfo("Using software mode for video rendering.");
}
#ifdef DISPLAY_OPENGL
else if(videodriver == "gl")
{
theDisplay = new FrameBufferGL();
theUseOpenGLFlag = true;
ShowInfo("Using OpenGL mode for video.");
ShowInfo("Using OpenGL mode for video rendering.");
}
#endif
else // a driver that doesn't exist was requested, so use software mode
{
theDisplay = new FrameBufferSoft();
ShowInfo("Using software mode for video.");
ShowInfo("Using software mode for video rendering.");
}
if(!theDisplay)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.29 2004-08-17 01:17:08 stephena Exp $
// $Id: Settings.cxx,v 1.30 2004-09-14 16:10:28 stephena Exp $
//============================================================================
#include <cassert>
@ -33,6 +33,7 @@ Settings::Settings()
// Now fill it with options that are common to all versions of Stella
set("video", "soft");
set("video_driver", "");
#ifdef DISPLAY_OPENGL
set("gl_filter", "nearest");
set("gl_aspect", "2");
@ -175,6 +176,7 @@ void Settings::usage()
<< " soft SDL software mode\n"
#ifdef DISPLAY_OPENGL
<< " gl SDL OpenGL mode\n"
<< " -video_driver <type> SDL Video driver (see manual).\n"
<< endl
<< " -gl_filter <type> Type is one of the following:\n"
<< " nearest Normal scaling (GL_NEAREST)\n"