summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-07 19:07:15 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-07 21:56:29 +0300
commit21277ad5c877d90680b757b058a3759e8f8b5559 (patch)
tree71089c982d94f592b27ed690a5d52e013803ae17 /src/gui
parentae1ba709d91bd59d05da7b3e434658ec652f2355 (diff)
downloadmanaplus-21277ad5c877d90680b757b058a3759e8f8b5559.tar.gz
manaplus-21277ad5c877d90680b757b058a3759e8f8b5559.tar.bz2
manaplus-21277ad5c877d90680b757b058a3759e8f8b5559.tar.xz
manaplus-21277ad5c877d90680b757b058a3759e8f8b5559.zip
Add auto adjust perfomance ability.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup.cpp3
-rw-r--r--src/gui/setup_video.cpp44
-rw-r--r--src/gui/setup_video.h2
3 files changed, 33 insertions, 16 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 76588a860..33ff6ddb7 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -23,6 +23,7 @@
#include "gui/setup.h"
#include "configuration.h"
+#include "game.h"
#include "main.h"
#include "gui/setup_audio.h"
@@ -129,6 +130,8 @@ Setup::~Setup()
void Setup::action(const gcn::ActionEvent &event)
{
+ if (Game::instance())
+ Game::instance()->resetAdjustLevel();
if (event.getId() == "Apply")
{
setVisible(false);
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 72c2e151b..3e5c56f64 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -284,6 +284,7 @@ Setup_Video::Setup_Video():
mAltFps(config.getIntValue("altfpslimit")),
mAlphaCache(config.getBoolValue("alphaCache")),
mEnableMapReduce(config.getBoolValue("enableMapReduce")),
+ mAdjustPerfomance(config.getBoolValue("adjustPerfomance")),
mBeingOpacity(config.getBoolValue("beingopacity")),
mSpeechMode(static_cast<Being::Speech>(
config.getIntValue("speech"))),
@@ -304,6 +305,8 @@ Setup_Video::Setup_Video():
mAlphaCacheCheckBox(new CheckBox(_("Enable opacity cache"), mAlphaCache)),
mEnableMapReduceCheckBox(new CheckBox(_("Enable map reduce"),
mEnableMapReduce)),
+ mAdjustPerfomanceCheckBox(new CheckBox(_("Auto adjust perfomance"),
+ mAdjustPerfomance)),
mBeingOpacityCheckBox(new CheckBox(_("Show beings transparency"),
mBeingOpacity)),
mSpeechSlider(new Slider(0, 3)),
@@ -380,6 +383,7 @@ Setup_Video::Setup_Video():
mParticleDetailField->setActionEventId("particledetailfield");
mAlphaCacheCheckBox->setActionEventId("alphaCache");
mEnableMapReduceCheckBox->setActionEventId("enableMapReduce");
+ mAdjustPerfomanceCheckBox->setActionEventId("adjustPerfomance");
mOpenGLDropDown->setActionEventId("opengl");
mModeList->addActionListener(this);
@@ -400,6 +404,7 @@ Setup_Video::Setup_Video():
mAlphaCacheCheckBox->addKeyListener(this);
mEnableMapReduceCheckBox->addKeyListener(this);
+ mAdjustPerfomanceCheckBox->addKeyListener(this);
mSpeechLabel->setCaption(speechModeToString(mSpeechMode));
mSpeechSlider->setValue(mSpeechMode);
@@ -433,27 +438,29 @@ Setup_Video::Setup_Video():
place(1, 5, mPickupChatCheckBox, 1);
place(2, 5, mPickupParticleCheckBox, 2);
- place(0, 9, mAlphaSlider);
- place(1, 9, alphaLabel, 3);
+ place(0, 9, mAdjustPerfomanceCheckBox, 6);
- place(0, 10, mFpsSlider);
- place(1, 10, mFpsCheckBox).setPadding(3);
- place(2, 10, mFpsLabel).setPadding(1);
+ place(0, 10, mAlphaSlider);
+ place(1, 10, alphaLabel, 3);
- place(0, 11, mAltFpsSlider);
- place(1, 11, mAltFpsLabel).setPadding(3);
+ place(0, 11, mFpsSlider);
+ place(1, 11, mFpsCheckBox).setPadding(3);
+ place(2, 11, mFpsLabel).setPadding(1);
- place(0, 12, mSpeechSlider);
- place(1, 12, speechLabel);
- place(2, 12, mSpeechLabel, 3).setPadding(2);
+ place(0, 12, mAltFpsSlider);
+ place(1, 12, mAltFpsLabel).setPadding(3);
- place(0, 13, mOverlayDetailSlider);
- place(1, 13, overlayDetailLabel);
- place(2, 13, mOverlayDetailField, 3).setPadding(2);
+ place(0, 13, mSpeechSlider);
+ place(1, 13, speechLabel);
+ place(2, 13, mSpeechLabel, 3).setPadding(2);
- place(0, 14, mParticleDetailSlider);
- place(1, 14, particleDetailLabel);
- place(2, 14, mParticleDetailField, 3).setPadding(2);
+ place(0, 14, mOverlayDetailSlider);
+ place(1, 14, overlayDetailLabel);
+ place(2, 14, mOverlayDetailField, 3).setPadding(2);
+
+ place(0, 15, mParticleDetailSlider);
+ place(1, 15, particleDetailLabel);
+ place(2, 15, mParticleDetailField, 3).setPadding(2);
int width = 600;
@@ -552,6 +559,8 @@ void Setup_Video::apply()
config.setValue("alphaCache", mAlphaCacheCheckBox->isSelected());
config.setValue("enableMapReduce", mEnableMapReduceCheckBox->isSelected());
+ config.setValue("adjustPerfomance",
+ mAdjustPerfomanceCheckBox->isSelected());
config.setValue("beingopacity", mBeingOpacityCheckBox->isSelected());
// We sync old and new values at apply time
@@ -560,6 +569,7 @@ void Setup_Video::apply()
mParticleEffectsEnabled = config.getBoolValue("particleeffects");
mAlphaCache = config.getBoolValue("alphaCache");
mEnableMapReduce = config.getBoolValue("enableMapReduce");
+ mAdjustPerfomance = config.getBoolValue("adjustPerfomance");
mBeingOpacity = config.getBoolValue("beingopacity");
mSpeechMode = static_cast<Being::Speech>(
@@ -587,6 +597,7 @@ void Setup_Video::cancel()
mSpeechSlider->setValue(mSpeechMode);
mAlphaCacheCheckBox->setSelected(mAlphaCache);
mEnableMapReduceCheckBox->setSelected(mEnableMapReduce);
+ mAdjustPerfomanceCheckBox->setSelected(mAdjustPerfomance);
mBeingOpacityCheckBox->setSelected(mBeingOpacity);
mAlphaSlider->setValue(mOpacity);
mOverlayDetailSlider->setValue(mOverlayDetail);
@@ -609,6 +620,7 @@ void Setup_Video::cancel()
config.setValue("speech", static_cast<int>(mSpeechMode));
config.setValue("alphaCache", mAlphaCache);
config.setValue("enableMapReduce", mEnableMapReduce);
+ config.setValue("adjustPerfomance", mAdjustPerfomance);
config.setValue("beingopacity", mBeingOpacity);
config.setValue("guialpha", mOpacity);
Image::setEnableAlpha(mOpacity != 1.0f);
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index f5d3208c8..9533877fb 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -65,6 +65,7 @@ class Setup_Video : public SetupTab, public gcn::KeyListener
int mAltFps;
bool mAlphaCache;
bool mEnableMapReduce;
+ bool mAdjustPerfomance;
bool mBeingOpacity;
Being::Speech mSpeechMode;
@@ -92,6 +93,7 @@ class Setup_Video : public SetupTab, public gcn::KeyListener
gcn::CheckBox *mAlphaCacheCheckBox;
gcn::CheckBox *mEnableMapReduceCheckBox;
+ gcn::CheckBox *mAdjustPerfomanceCheckBox;
gcn::CheckBox *mBeingOpacityCheckBox;
gcn::Slider *mSpeechSlider;
gcn::Label *mSpeechLabel;