diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-28 19:42:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-28 23:13:01 +0300 |
commit | a5922daffebf5d78936cf248a7a6a8bfc86c026c (patch) | |
tree | 97b30d52dd6071942259a3fddbe2b2f5f727594f /src/graphicsmanager.cpp | |
parent | d0832a59dad69f72b514b87e380017ad3f14dfc6 (diff) | |
download | manaverse-a5922daffebf5d78936cf248a7a6a8bfc86c026c.tar.gz manaverse-a5922daffebf5d78936cf248a7a6a8bfc86c026c.tar.bz2 manaverse-a5922daffebf5d78936cf248a7a6a8bfc86c026c.tar.xz manaverse-a5922daffebf5d78936cf248a7a6a8bfc86c026c.zip |
Done select always best resolution under Android.
Select it only if current resolution incorrect.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r-- | src/graphicsmanager.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 5abd85297..655040aab 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -277,14 +277,30 @@ void GraphicsManager::setVideoMode() getAllVideoModes(videoModes); if (!videoModes.empty()) { - std::string str = videoModes[0]; - std::vector<int> res; - splitToIntVector(res, videoModes[0], 'x'); - if (res.size() == 2) + bool found(false); + std::string str = strprintf("%dx%d", width, height); + for (StringVectCIter it = videoModes.begin(), it_end = videoModes.end(); + it != it_end; ++ it) { - width = res[0]; - height = res[1]; - logger->log("Autoselect mode %dx%d", width, height); + if (str == *it) + { + found = true; + break; + } + } + + if (!found) + { + logger->log("Current resolution %s is incorrect.", str.c_str()); + str = videoModes[0]; + std::vector<int> res; + splitToIntVector(res, videoModes[0], 'x'); + if (res.size() == 2) + { + width = res[0]; + height = res[1]; + logger->log("Autoselect mode %dx%d", width, height); + } } } #endif |