summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-08-28 13:08:10 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-31 20:40:09 +0100
commit487e43ff4e940f0fe1b93d261598212f7da2fba6 (patch)
tree14335e7694efae0875f0d87252c4a0e26dd7fa2e
parentd0383ae09babc015b84997241d403b01ad40f677 (diff)
downloadcolobot-487e43ff4e940f0fe1b93d261598212f7da2fba6.tar.gz
colobot-487e43ff4e940f0fe1b93d261598212f7da2fba6.tar.bz2
colobot-487e43ff4e940f0fe1b93d261598212f7da2fba6.zip
Changing resolution from commandline
Conflicts: src/app/app.cpp
-rw-r--r--src/app/app.cpp24
-rw-r--r--src/app/app.h3
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;
};