From db523d927180ff84b952f2655ceae93e0239a545 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Aug 2013 23:31:40 +0300 Subject: fix detecting possible resolutions in SDL2. --- src/utils/sdl2helper.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/utils') 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 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::const_iterator, it, modes) + modeList.push_back(*it); return true; } -- cgit v1.2.3-70-g09d2