summaryrefslogtreecommitdiff
path: root/src/gui/setup.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-02 21:53:36 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-02 21:53:36 +0000
commit88b41d7c9ffe40248218a7af58d92910c6737679 (patch)
tree3535eef1d6585a0c522255323d865d568bb58671 /src/gui/setup.cpp
parent56797f661324ca160d1f7b3b678be9b1eaf8b534 (diff)
downloadmana-88b41d7c9ffe40248218a7af58d92910c6737679.tar.gz
mana-88b41d7c9ffe40248218a7af58d92910c6737679.tar.bz2
mana-88b41d7c9ffe40248218a7af58d92910c6737679.tar.xz
mana-88b41d7c9ffe40248218a7af58d92910c6737679.zip
Moved graphics setup code into the graphics class.
Diffstat (limited to 'src/gui/setup.cpp')
-rw-r--r--src/gui/setup.cpp45
1 files changed, 13 insertions, 32 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index cda9ae31..91f64ecc 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -214,39 +214,20 @@ void Setup::action(const std::string &eventId)
else if (eventId == "apply")
{
setVisible(false);
- bool changed = false;
-
- if (fsCheckBox->isMarked() && config.getValue("screen", 0) == 0) {
- // Fullscreen
- config.setValue("screen", 1);
- displayFlags |= SDL_FULLSCREEN;
- changed = true;
- }
- else if(!fsCheckBox->isMarked() && config.getValue("screen", 0) == 1) {
- // Windowed
- config.setValue("screen", 0);
- displayFlags &= ~SDL_FULLSCREEN;
- changed = true;
- }
-
- if(changed) {
- displayFlags |= SDL_DOUBLEBUF;
- if (useOpenGL) {
- //displayFlags |= SDL_OPENGL;
- //SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ bool fullscreen = fsCheckBox->isMarked();
+
+ if (fullscreen != (config.getValue("screen", 0) == 1)) {
+ if (!guiGraphics->setFullscreen(fullscreen)) {
+ fullscreen = !fullscreen;
+ if (!guiGraphics->setFullscreen(fullscreen)) {
+ std::cerr << "Failed to switch to " <<
+ (fullscreen ? "windowed" : "fullscreen") <<
+ "mode and restoration of old mode also failed!" <<
+ std::endl;
+ exit(1);
+ }
}
-
- SDL_Surface *screen =
- SDL_SetVideoMode(screenW, screenH, bitDepth, displayFlags);
-
- if (screen == NULL) {
- std::cerr << "Couldn't set " << screenW << "x" <<
- screenH << "x" << bitDepth << " video mode: " <<
- SDL_GetError() << std::endl;
- exit(1);
- }
-
- guiGraphics->setScreen(screen);
+ config.setValue("screen", fullscreen ? 1 : 0);
}
// Sound settings