summaryrefslogtreecommitdiff
path: root/src/gui/setup_video.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-09 23:47:02 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-09 23:47:02 +0100
commitfa2f3ac593a792c32095c2e885665ec91bb4019d (patch)
treef44aee845f0229dfcc6b2ad3c74613e0352f36c2 /src/gui/setup_video.cpp
parent07f7d52f661a74e6d0c780ca53e724651e3dcc48 (diff)
parent40edf4e91558cffd83d9015a2cf4a16360e27855 (diff)
downloadmana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.gz
mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.bz2
mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.xz
mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.zip
Merged with Aethyra master as of 2009-02-09
Conflicts: A lot of files...
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r--src/gui/setup_video.cpp69
1 files changed, 26 insertions, 43 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 2381ab41..b1d33b09 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -104,12 +104,12 @@ ModeListModel::ModeListModel()
}
Setup_Video::Setup_Video():
- mFullScreenEnabled(config.getValue("screen", 0)),
- mOpenGLEnabled(config.getValue("opengl", 0)),
- mCustomCursorEnabled(config.getValue("customcursor", 1)),
- mParticleEffectsEnabled(config.getValue("particleeffects", 1)),
- mSpeechBubbleEnabled(config.getValue("speechbubble", 1)),
- mNameEnabled(config.getValue("showownname", 0)),
+ mFullScreenEnabled(config.getValue("screen", false)),
+ mOpenGLEnabled(config.getValue("opengl", false)),
+ mCustomCursorEnabled(config.getValue("customcursor", true)),
+ mParticleEffectsEnabled(config.getValue("particleeffects", true)),
+ mSpeechBubbleEnabled(config.getValue("speechbubble", true)),
+ mNameEnabled(config.getValue("showownname", false)),
mOpacity(config.getValue("guialpha", 0.8)),
mFps((int) config.getValue("fpslimit", 0)),
mModeListModel(new ModeListModel),
@@ -280,7 +280,7 @@ void Setup_Video::apply()
{
// Full screen changes
bool fullscreen = mFsCheckBox->isSelected();
- if (fullscreen != (config.getValue("screen", 0) == 1))
+ if (fullscreen != (config.getValue("screen", false) == 1))
{
/* The OpenGL test is only necessary on Windows, since switching
* to/from full screen works fine on Linux. On Windows we'd have to
@@ -291,7 +291,7 @@ void Setup_Video::apply()
#if defined(WIN32) || defined(__APPLE__)
// checks for opengl usage
- if (!(config.getValue("opengl", 0) == 1))
+ if (!(config.getValue("opengl", false) == 1))
{
#endif
if (!graphics->setFullscreen(fullscreen))
@@ -313,13 +313,13 @@ void Setup_Video::apply()
_("Restart needed for changes to take effect."));
}
#endif
- config.setValue("screen", fullscreen ? 1 : 0);
+ config.setValue("screen", fullscreen ? true : false);
}
// OpenGL change
if (mOpenGLCheckBox->isSelected() != mOpenGLEnabled)
{
- config.setValue("opengl", mOpenGLCheckBox->isSelected() ? 1 : 0);
+ config.setValue("opengl", mOpenGLCheckBox->isSelected() ? true : false);
// OpenGL can currently only be changed by restarting, notify user.
new OkDialog(_("Changing OpenGL"),
@@ -330,14 +330,14 @@ void Setup_Video::apply()
config.setValue("fpslimit", mFps);
// We sync old and new values at apply time
- mFullScreenEnabled = config.getValue("screen", 0);
- mCustomCursorEnabled = config.getValue("customcursor", 1);
- mParticleEffectsEnabled = config.getValue("particleeffects", 1);
- mSpeechBubbleEnabled = config.getValue("speechbubble", 1);
- mNameEnabled = config.getValue("showownname", 0);
+ mFullScreenEnabled = config.getValue("screen", false);
+ mCustomCursorEnabled = config.getValue("customcursor", true);
+ mParticleEffectsEnabled = config.getValue("particleeffects", true);
+ mSpeechBubbleEnabled = config.getValue("speechbubble", true);
+ mNameEnabled = config.getValue("showownname", false);
mOpacity = config.getValue("guialpha", 0.8);
mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
- mOpenGLEnabled = config.getValue("opengl", 0);
+ mOpenGLEnabled = config.getValue("opengl", false);
}
int Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field,
@@ -377,13 +377,13 @@ void Setup_Video::cancel()
updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius");
updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness");
- config.setValue("screen", mFullScreenEnabled ? 1 : 0);
- config.setValue("customcursor", mCustomCursorEnabled ? 1 : 0);
- config.setValue("particleeffects", mParticleEffectsEnabled ? 1 : 0);
- config.setValue("speechbubble", mSpeechBubbleEnabled ? 1 : 0);
- config.setValue("showownname", mNameEnabled ? 1 : 0);
+ config.setValue("screen", mFullScreenEnabled ? true : false);
+ config.setValue("customcursor", mCustomCursorEnabled ? true : false);
+ config.setValue("particleeffects", mParticleEffectsEnabled ? true : false);
+ config.setValue("speechbubble", mSpeechBubbleEnabled ? true : false);
+ config.setValue("showownname", mNameEnabled ? true : false);
config.setValue("guialpha", mOpacity);
- config.setValue("opengl", mOpenGLEnabled ? 1 : 0);
+ config.setValue("opengl", mOpenGLEnabled ? true : false);
}
void Setup_Video::action(const gcn::ActionEvent &event)
@@ -393,23 +393,6 @@ void Setup_Video::action(const gcn::ActionEvent &event)
const std::string mode = mModeListModel->getElementAt(mModeList->getSelected());
const int width = atoi(mode.substr(0, mode.find("x")).c_str());
const int height = atoi(mode.substr(mode.find("x") + 1).c_str());
- const int bpp = 0;
- const bool fullscreen = ((int) config.getValue("screen", 0) == 1);
- const bool hwaccel = ((int) config.getValue("hwaccel", 0) == 1);
-
- // Try to set the desired video mode
- if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel))
- {
- std::cerr << _("Couldn't set ")
- << width << "x" << height << "x" << bpp << _(" video mode: ")
- << SDL_GetError() << std::endl;
- exit(1);
- }
-
- // Initialize for drawing
- graphics->_endDraw();
- graphics->_beginDraw();
- graphics->updateScreen();
// TODO: Find out why the drawing area doesn't resize without a restart.
new OkDialog(_("Screen resolution changed"),
@@ -425,19 +408,19 @@ void Setup_Video::action(const gcn::ActionEvent &event)
else if (event.getId() == "customcursor")
{
config.setValue("customcursor",
- mCustomCursorCheckBox->isSelected() ? 1 : 0);
+ mCustomCursorCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "particleeffects")
{
config.setValue("particleeffects",
- mParticleEffectsCheckBox->isSelected() ? 1 : 0);
+ mParticleEffectsCheckBox->isSelected() ? true : false);
new OkDialog(_("Particle effect settings changed"),
_("Restart your client or change maps for the change to take effect."));
}
else if (event.getId() == "speechbubble")
{
config.setValue("speechbubble",
- mSpeechBubbleCheckBox->isSelected() ? 1 : 0);
+ mSpeechBubbleCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "showownname")
{
@@ -446,7 +429,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
if (player_node)
player_node->mUpdateName = true;
config.setValue("showownname",
- mNameCheckBox->isSelected() ? 1 : 0);
+ mNameCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "fpslimitslider")
{