summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-30 19:15:19 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-30 19:21:47 +0300
commitecbb00ef04a6beb305a7c85839502500226d34bf (patch)
tree460d412bb0dfc3a21951bf047b79bf933d42a697 /src/graphicsmanager.cpp
parent0cff44ef5c1383a638c30cc9f5f8c81b6b4318f9 (diff)
downloadmv-ecbb00ef04a6beb305a7c85839502500226d34bf.tar.gz
mv-ecbb00ef04a6beb305a7c85839502500226d34bf.tar.bz2
mv-ecbb00ef04a6beb305a7c85839502500226d34bf.tar.xz
mv-ecbb00ef04a6beb305a7c85839502500226d34bf.zip
Android: At first start select maximum allowed resolution.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index a63bfd254..1778f1075 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -264,8 +264,6 @@ Graphics *GraphicsManager::createGraphics()
void GraphicsManager::setVideoMode()
{
- int width = config.getIntValue("screenwidth");
- int height = config.getIntValue("screenheight");
const int bpp = 0;
const bool fullscreen = config.getBoolValue("screen");
const bool hwaccel = config.getBoolValue("hwaccel");
@@ -273,25 +271,35 @@ void GraphicsManager::setVideoMode()
const bool noFrame = config.getBoolValue("noframe");
#ifdef ANDROID
+ int width = config.getValue("screenwidth", 0);
+ int height = config.getValue("screenheight", 0);
StringVect videoModes;
getAllVideoModes(videoModes);
if (!videoModes.empty())
{
bool found(false);
std::string str = strprintf("%dx%d", width, height);
- for (StringVectCIter it = videoModes.begin(), it_end = videoModes.end();
- it != it_end; ++ it)
+ if (width != 0 && height != 0)
{
- if (str == *it)
+ for (StringVectCIter it = videoModes.begin(),
+ it_end = videoModes.end();
+ it != it_end; ++ it)
{
- found = true;
- break;
+ if (str == *it)
+ {
+ found = true;
+ break;
+ }
}
}
if (!found)
{
- logger->log("Current resolution %s is incorrect.", str.c_str());
+ if (width != 0 && height != 0)
+ {
+ logger->log("Current resolution %s is incorrect.",
+ str.c_str());
+ }
str = videoModes[0];
std::vector<int> res;
splitToIntVector(res, videoModes[0], 'x');
@@ -303,6 +311,9 @@ void GraphicsManager::setVideoMode()
}
}
}
+#else
+ int width = config.getIntValue("screenwidth");
+ int height = config.getIntValue("screenheight");
#endif
// Try to set the desired video mode