summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp33
-rw-r--r--src/gui/setup.cpp59
-rw-r--r--src/main.cpp14
-rw-r--r--src/main.h1
4 files changed, 29 insertions, 78 deletions
diff --git a/src/game.cpp b/src/game.cpp
index fb4fd8c2..118e6d3d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -336,39 +336,6 @@ void do_input()
}
}
}
-
- if (keysym.sym == SDLK_f)
- {
- if (keysym.mod & KMOD_CTRL)
- {
- // Workaround for Win and else
-#if __USE_UNIX98
- SDL_WM_ToggleFullScreen(screen);
- if ((int)config.getValue("screen", 0) == 0) {
- config.setValue("screen", 1);
- }
- else {
- config.setValue("screen", 0);
- }
-#else
- int displayFlags = 0;
- if ((int)config.getValue("screen", 0) == 0) {
- displayFlags |= SDL_FULLSCREEN;
- config.setValue("screen", 1);
- }
- else {
- config.setValue("screen", 0);
- }
- if ((int)config.getValue("hwaccel", 0)) {
- displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
- }
- else {
- displayFlags |= SDL_SWSURFACE;
- }
- screen = SDL_SetVideoMode(800, 600, 32, displayFlags);
-#endif
- }
- }
} // End key down
else if (event.type == SDL_MOUSEBUTTONDOWN)
{
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 85aa900d..a8c4721e 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -190,53 +190,30 @@ void Setup::action(const std::string &eventId)
else if (eventId == "apply")
{
setVisible(false);
-
- // Select video mode
- sel = modeList->getSelected();
-
- if (sel != last_sel) {
- last_sel = sel;
- screen = SDL_SetVideoMode(modes[sel]->w, modes[sel]->h, 32,
- SDL_FULLSCREEN | SDL_HWSURFACE);
- }
-
- // Display settings
- if (fsCheckBox->isMarked() && config.getValue("screen", 0) == 0)
- {
+
+ /*screenW = modes[sel]->w;
+ screenH = modes[sel]->h;*/
+
+ if (fsCheckBox->isMarked()) { // Fullscreen
config.setValue("screen", 1);
-#if __USE_UNIX98
- SDL_WM_ToggleFullScreen(screen);
-#else
- int displayFlags = 0;
displayFlags |= SDL_FULLSCREEN;
- if ((int)config.getValue("hwaccel", 0)) {
- displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
- }
- else {
- displayFlags |= SDL_SWSURFACE;
- }
- screen = SDL_SetVideoMode(modes[sel]->w, modes[sel]->h, 32,
- displayFlags);
-#endif
-
}
- else if (!fsCheckBox->isMarked() && config.getValue("screen", 0) == 1)
- {
+ else { // Windowed
config.setValue("screen", 0);
-#if __USE_UNIX98
- SDL_WM_ToggleFullScreen(screen);
+ displayFlags &= ~SDL_FULLSCREEN;
+ }
+
+ screen = SDL_SetVideoMode(screenW, screenH, bitDepth, displayFlags);
+
+/* if (displayFlags & SDL_FULLSCREEN) {
+#ifdef WIN32
+ displayFlags ^= SDL_FULLSCREEN;
+ screen = SDL_SetVideoMode(screenW, screenH, bitDepth, displayFlags);
#else
- int displayFlags = 0;
- if ((int)config.getValue("hwaccel", 0)) {
- displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
- }
- else {
- displayFlags |= SDL_SWSURFACE;
- }
- screen = SDL_SetVideoMode(modes[sel]->w, modes[sel]->h, 32,
- displayFlags);
+ SDL_WM_ToggleFullScreen(screen);
#endif
- }
+ }*/
+
// Sound settings
if (soundCheckBox->isMarked()) {
diff --git a/src/main.cpp b/src/main.cpp
index d1e43560..3e9d1adf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -65,6 +65,7 @@ char map_name[16];
unsigned char state;
unsigned char screen_mode;
char *dir = NULL;
+int displayFlags, screenW, screenH, bitDepth;
Sound sound;
@@ -189,7 +190,7 @@ void init_engine()
SDL_WM_SetCaption("The Mana World", NULL);
- int displayFlags = SDL_ANYFORMAT;
+ displayFlags = SDL_ANYFORMAT;
if ((int)config.getValue("screen", 0) == 1) {
displayFlags |= SDL_FULLSCREEN;
@@ -207,10 +208,15 @@ void init_engine()
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#endif
- screen = SDL_SetVideoMode(800, 600, 16, displayFlags);
+ // TODO: the following variables should be loaded from config file
+ screenW = 800;
+ screenH = 600;
+ bitDepth = 16;
+
+ screen = SDL_SetVideoMode(screenW, screenH, bitDepth, displayFlags);
if (screen == NULL) {
- std::cerr << "Couldn't set 800x600x16 video mode: " <<
- SDL_GetError() << std::endl;
+ std::cerr << "Couldn't set " << screenW << "x" << screenH << "x" <<
+ bitDepth << " video mode: " << SDL_GetError() << std::endl;
exit(1);
}
diff --git a/src/main.h b/src/main.h
index 690fbdc3..8b77db97 100644
--- a/src/main.h
+++ b/src/main.h
@@ -102,5 +102,6 @@ extern Configuration config;
extern Sound sound;
extern Map *tiledMap;
extern Logger logger;
+extern int screenW, screenH, bitDepth, displayFlags;
#endif