summaryrefslogtreecommitdiff
path: root/src/gui/setup_video.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r--src/gui/setup_video.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 5a697160..ac419de5 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -26,8 +26,6 @@
#include "game.h"
#include "graphics.h"
#include "localplayer.h"
-#include "log.h"
-#include "main.h"
#include "gui/okdialog.h"
@@ -38,8 +36,6 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/slider.h"
#include "gui/widgets/spacer.h"
-#include "gui/widgets/textfield.h"
-#include "gui/widgets/dropdown.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -90,26 +86,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 < 360)
- continue;
+ // Skip the unreasonably small modes
+ if (mode.w < 640 || mode.h < 360)
+ 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));
}
}
@@ -255,9 +246,7 @@ void Setup_Video::apply()
{
if (!graphics->changeVideoMode(screenWidth,
screenHeight,
- graphics->getBpp(),
- fullscreen,
- graphics->getHWAccel()))
+ fullscreen))
{
std::stringstream errorMessage;
if (fullscreen)