[colobot] 152/390: Changing resolution from commandline

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 487e43ff4e940f0fe1b93d261598212f7da2fba6
Author: krzys-h <krzys_h at interia.pl>
Date:   Thu Aug 28 13:08:10 2014 +0200

    Changing resolution from commandline
    
    Conflicts:
    	src/app/app.cpp
---
 src/app/app.cpp | 24 +++++++++++++++++++-----
 src/app/app.h   |  3 +++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/app/app.cpp b/src/app/app.cpp
index ae1f82a..513fc27 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -168,12 +168,11 @@ CApplication::CApplication()
     m_runSceneRank = 0;
 
     m_sceneTest = false;
+    m_resolutionOverride = false;
 
     m_language = LANGUAGE_ENV;
 
     m_lowCPU = true;
-
-    m_protoMode = false;
 }
 
 CApplication::~CApplication()
@@ -228,7 +227,8 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
         OPT_DATADIR,
         OPT_SAVEDIR,
         OPT_MOD,
-        OPT_VBO
+        OPT_VBO,
+        OPT_RESOLUTION
     };
 
     option options[] =
@@ -244,6 +244,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
         { "savedir", required_argument, nullptr, OPT_SAVEDIR },
         { "mod", required_argument, nullptr, OPT_MOD },
         { "vbo", required_argument, nullptr, OPT_VBO },
+        { "resolution", required_argument, nullptr, OPT_RESOLUTION },
         { nullptr, 0, nullptr, 0}
     };
 
@@ -285,6 +286,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
                 GetLogger()->Message("  -savedir path       set custom save directory path (must be writable)\n");
                 GetLogger()->Message("  -mod path           load datadir mod from given path\n");
                 GetLogger()->Message("  -vbo mode           set OpenGL VBO mode (one of: auto, enable, disable)\n");
+                GetLogger()->Message("  -resolution WxH     set resolution\n");
                 return PARSE_ARGS_HELP;
             }
             case OPT_DEBUG:
@@ -388,6 +390,18 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
                 CResourceManager::AddLocation(optarg, true);
                 break;
             }
+            case OPT_RESOLUTION:
+            {
+                std::istringstream resolution(optarg);
+                std::string w, h;
+                std::getline(resolution, w, 'x');
+                std::getline(resolution, h, 'x');
+                
+                m_deviceConfig.size.x = atoi(w.c_str());
+                m_deviceConfig.size.y = atoi(h.c_str());
+                m_resolutionOverride = true;
+                break;
+            }
             default:
                 assert(false); // should never get here
         }
@@ -493,7 +507,7 @@ bool CApplication::Create()
 
     // load settings from profile
     int iValue;
-    if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) )
+    if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) && !m_resolutionOverride )
     {
         std::vector<Math::IntPoint> modes;
         GetVideoResolutionList(modes, true, true);
@@ -501,7 +515,7 @@ bool CApplication::Create()
             m_deviceConfig.size = modes.at(iValue);
     }
 
-    if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) )
+    if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) && !m_resolutionOverride )
     {
         m_deviceConfig.fullScreen = (iValue == 1);
     }
diff --git a/src/app/app.h b/src/app/app.h
index 500cb2f..d933374 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -503,5 +503,8 @@ protected:
 
     //! Show prototype levels
     bool            m_protoMode;
+    
+    //! Screen resoultion overriden by commandline
+    bool            m_resolutionOverride;
 };
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list