diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 23:31:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 23:47:03 +0300 |
commit | db523d927180ff84b952f2655ceae93e0239a545 (patch) | |
tree | d1d9553170b354730f28a2c85cfceb7b5b023a0f | |
parent | c4e3b6cb2c4d8dceb45ee2da549ec42daabc053d (diff) | |
download | plus-db523d927180ff84b952f2655ceae93e0239a545.tar.gz plus-db523d927180ff84b952f2655ceae93e0239a545.tar.bz2 plus-db523d927180ff84b952f2655ceae93e0239a545.tar.xz plus-db523d927180ff84b952f2655ceae93e0239a545.zip |
fix detecting possible resolutions in SDL2.
-rw-r--r-- | src/utils/sdl2helper.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 683a1b322..5c61bf79c 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -34,7 +34,29 @@ bool SDL::getAllVideoModes(StringVect &modeList) { // +++ need use SDL_GetDisplayMode and SDL_GetNumDisplayModes - modeList.push_back("800x600"); +// modeList.push_back("800x600"); + + std::set<std::string> modes; + + for (int display = 0; display < 100; display ++) + { + const int numModes = SDL_GetNumDisplayModes(display); + if (numModes > 0) + { + logger->log("Modes for display %d", display); + for (int f = 0; f < numModes; f ++) + { + SDL_DisplayMode mode; + SDL_GetDisplayMode(display, f, &mode); + const int w = mode.w; + const int h = mode.h; + logger->log("%dx%dx%d", w, h, mode.refresh_rate); + modes.insert(strprintf("%dx%d", w, h)); + } + } + } + FOR_EACH (std::set<std::string>::const_iterator, it, modes) + modeList.push_back(*it); return true; } |