From a5922daffebf5d78936cf248a7a6a8bfc86c026c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Oct 2012 19:42:17 +0300 Subject: Done select always best resolution under Android. Select it only if current resolution incorrect. --- src/graphicsmanager.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/graphicsmanager.cpp') 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 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 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 -- cgit v1.2.3-70-g09d2