From ecbb00ef04a6beb305a7c85839502500226d34bf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 30 Oct 2012 19:15:19 +0300 Subject: Android: At first start select maximum allowed resolution. --- src/graphicsmanager.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src') 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 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 -- cgit v1.2.3-60-g2f50