From 91d07ce9e2de34e1cf59a2439adc075849694538 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 26 Apr 2009 11:45:12 -0600 Subject: Add a command line option to disable OpenGL --- src/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 14baffbd..a9e455db 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -216,6 +216,8 @@ struct Options std::string serverName; short serverPort; + + bool noOpenGL; }; /** @@ -457,7 +459,7 @@ static void initEngine(const Options &options) #endif #ifdef USE_OPENGL - bool useOpenGL = (config.getValue("opengl", 0) == 1); + bool useOpenGL = !options.noOpenGL && (config.getValue("opengl", 0) == 1); // Setup image loading for the right image format Image::setLoadAsOpenGL(useOpenGL); @@ -575,6 +577,7 @@ static void printHelp() << _(" -s --server : Login Server name or IP") << std::endl << _(" -u --skipupdate : Skip the update downloads") << std::endl << _(" -U --username : Login with this username") << std::endl + << _(" -O --noopengl : Disable OpenGL for this sesion") << std::endl << _(" -v --version : Display the version") << std::endl; } @@ -585,7 +588,7 @@ static void printVersion() static void parseOptions(int argc, char *argv[], Options &options) { - const char *optstring = "hvud:U:P:Dc:s:o:C:H:S:"; + const char *optstring = "hvud:U:P:Dc:s:o:C:H:S:O"; const struct option long_options[] = { { "configfile", required_argument, 0, 'C' }, @@ -600,6 +603,7 @@ static void parseOptions(int argc, char *argv[], Options &options) { "server", required_argument, 0, 's' }, { "skipupdate", no_argument, 0, 'u' }, { "username", required_argument, 0, 'U' }, + { "noopengl", no_argument, 0, 'O' }, { "version", no_argument, 0, 'v' }, { 0 } }; @@ -654,6 +658,9 @@ static void parseOptions(int argc, char *argv[], Options &options) case 'S': homeDir = optarg; break; + case 'O': + options.noOpenGL = true; + break; } } } -- cgit v1.2.3-70-g09d2