diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
commit | 2c51c98625b225cecfb9628c30d62d4e30f7e3e1 (patch) | |
tree | 5f8f85a40785439b6a9ea249a75e81e26d1b44f1 /src/gui/setup_video.cpp | |
parent | 8fdbae08d7f269c72889f89b56493071a2279350 (diff) | |
download | mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.gz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.bz2 mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.xz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.zip |
Ported to SDL2
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r-- | src/gui/setup_video.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index c4fe60a1..c9d1dbc9 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -26,7 +26,6 @@ #include "game.h" #include "graphics.h" #include "localplayer.h" -#include "log.h" #include "main.h" #include "particle.h" @@ -91,26 +90,21 @@ class ModeListModel : public gcn::ListModel ModeListModel::ModeListModel() { /* Get available fullscreen/hardware modes */ - SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); - - /* Check which modes are available */ - if (modes == (SDL_Rect **)0) - logger->log("No modes available"); - else if (modes == (SDL_Rect **)-1) - logger->log("All resolutions available"); - else + const int numModes = SDL_GetNumDisplayModes(0); + for (int i = 0; i < numModes; i++) { - for (int i = 0; modes[i]; ++i) - { - const int width = modes[i]->w; - const int height = modes[i]->h; + SDL_DisplayMode mode; + if (SDL_GetDisplayMode(0, i, &mode) != 0) + continue; - // Skip the unreasonably small modes - if (width < 640 || height < 480) - continue; + // Skip the unreasonably small modes + if (mode.w < 640 || mode.h < 480) + continue; - mVideoModes.push_back(toString(width) + "x" + toString(height)); - } + // TODO_SDL2: Modes now dinstinguish between pixel format and refresh rate as well + // TODO_SDL2: Fullscreen mode needs display selection + + mVideoModes.push_back(toString(mode.w) + "x" + toString(mode.h)); } } @@ -326,9 +320,7 @@ void Setup_Video::apply() { if (!graphics->changeVideoMode(screenWidth, screenHeight, - graphics->getBpp(), - fullscreen, - graphics->getHWAccel())) + fullscreen)) { std::stringstream errorMessage; if (fullscreen) |