summaryrefslogtreecommitdiff
path: root/src/gui/setup.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-06-27 06:29:02 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-06-27 06:29:02 +0000
commit795a2759db97111e27b1de3b904dca4ec926bd04 (patch)
treec669673c0b92f155d7aeae68d66d38395d57d520 /src/gui/setup.cpp
parent8f786b2f02c225d41d397aaf7f826623eb1b7181 (diff)
downloadmana-client-795a2759db97111e27b1de3b904dca4ec926bd04.tar.gz
mana-client-795a2759db97111e27b1de3b904dca4ec926bd04.tar.bz2
mana-client-795a2759db97111e27b1de3b904dca4ec926bd04.tar.xz
mana-client-795a2759db97111e27b1de3b904dca4ec926bd04.zip
- Fixing OpenGL switch to fullscreen crash in windows
- Improving switch check
Diffstat (limited to 'src/gui/setup.cpp')
-rw-r--r--src/gui/setup.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 629c0c86..a01e804f 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -201,23 +201,35 @@ void Setup::action(const std::string &eventId)
else if (eventId == "apply")
{
setVisible(false);
+ bool changed = false;
- if (fsCheckBox->isMarked()) { // Fullscreen
+ if (fsCheckBox->isMarked() && config.getValue("screen", 0) == 0) {
+ // Fullscreen
config.setValue("screen", 1);
displayFlags |= SDL_FULLSCREEN;
+ changed = true;
}
- else { // Windowed
+ else if(!fsCheckBox->isMarked() && config.getValue("screen", 0) == 1) {
+ // Windowed
config.setValue("screen", 0);
displayFlags &= ~SDL_FULLSCREEN;
+ changed = true;
}
-
- displayFlags |= SDL_DOUBLEBUF;
-
- 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;
+
+ if(changed) {
+ displayFlags |= SDL_DOUBLEBUF;
+ if (useOpenGL) {
+ displayFlags |= SDL_OPENGL;
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ }
+
+ 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);
+ }
}
// Sound settings