From 2dfd979ea4c0c1a1046461ac21213d8211175c36 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 28 May 2008 20:22:37 +0000 Subject: Added slider for controlling particleEmitterSkip (overall quality of particle effects) to video setup menu. --- src/gui/setup.cpp | 4 ++-- src/gui/setup_video.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++- src/gui/setup_video.h | 4 ++++ 3 files changed, 62 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 54bf01f4..c895d166 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -49,7 +49,7 @@ Setup::Setup(): { setCloseButton(true); int width = 310; - int height = 245; + int height = 265; setContentSize(width, height); const char *buttonNames[] = { @@ -64,7 +64,7 @@ Setup::Setup(): } TabbedContainer *panel = new TabbedContainer(); - panel->setDimension(gcn::Rectangle(5, 5, width, 205)); + panel->setDimension(gcn::Rectangle(5, 5, width, height - 40)); panel->setOpaque(false); SetupTab *tab; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d0c3d5e3..33d9ad73 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -43,6 +43,7 @@ #include "../graphics.h" #include "../log.h" #include "../main.h" +#include "../particle.h" #include "../utils/tostring.h" @@ -124,7 +125,10 @@ Setup_Video::Setup_Video(): mScrollRadiusField(new TextField()), mOverlayDetail((int) config.getValue("OverlayDetail", 2)), mOverlayDetailSlider(new Slider(0, 2)), - mOverlayDetailField(new gcn::Label("")) + mOverlayDetailField(new gcn::Label("")), + mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 0)), + mParticleDetailSlider(new Slider(0, 3)), + mParticleDetailField(new gcn::Label("")) { setOpaque(false); @@ -168,6 +172,8 @@ Setup_Video::Setup_Video(): mScrollLazinessField->setActionEventId("scrolllazinessfield"); mOverlayDetailSlider->setActionEventId("overlaydetailslider"); mOverlayDetailField->setActionEventId("overlaydetailfield"); + mParticleDetailSlider->setActionEventId("particledetailslider"); + mParticleDetailField->setActionEventId("particledetailfield"); mCustomCursorCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); @@ -180,6 +186,8 @@ Setup_Video::Setup_Video(): mScrollLazinessField->addKeyListener(this); mOverlayDetailSlider->addActionListener(this); mOverlayDetailField->addKeyListener(this); + mParticleDetailSlider->addActionListener(this); + mParticleDetailField->addKeyListener(this); mScrollRadiusSlider->setDimension(gcn::Rectangle(10, 120, 75, 10)); gcn::Label *scrollRadiusLabel = new gcn::Label("Scroll radius"); @@ -216,6 +224,28 @@ Setup_Video::Setup_Video(): } mOverlayDetailSlider->setValue(mOverlayDetail); + mParticleDetailSlider->setDimension(gcn::Rectangle(10, 180, 75, 10)); + gcn::Label *particleDetailLabel = new gcn::Label("Particle Detail"); + particleDetailLabel->setPosition(90, 180); + mParticleDetailField->setPosition(180, 180); + mParticleDetailField->setWidth(60); + switch (mParticleDetail) + { + case 0: + mParticleDetailField->setCaption("low"); + break; + case 1: + mParticleDetailField->setCaption("medium"); + break; + case 2: + mParticleDetailField->setCaption("high"); + break; + case 3: + mParticleDetailField->setCaption("max"); + break; + } + mParticleDetailSlider->setValue(mParticleDetail); + add(scrollArea); add(mFsCheckBox); add(mOpenGLCheckBox); @@ -234,6 +264,9 @@ Setup_Video::Setup_Video(): add(mOverlayDetailSlider); add(overlayDetailLabel); add(mOverlayDetailField); + add(mParticleDetailSlider); + add(particleDetailLabel); + add(mParticleDetailField); } Setup_Video::~Setup_Video() @@ -319,6 +352,7 @@ void Setup_Video::cancel() mCustomCursorCheckBox->setSelected(mCustomCursorEnabled); mAlphaSlider->setValue(mOpacity); mOverlayDetailSlider->setValue(mOverlayDetail); + mParticleDetailSlider->setValue(mParticleDetail); mScrollRadiusField->setText(toString(mOriginalScrollRadius)); mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); @@ -376,6 +410,27 @@ void Setup_Video::action(const gcn::ActionEvent &event) } config.setValue("OverlayDetail", val); } + else if (event.getId() == "particledetailslider") + { + int val = (int) mParticleDetailSlider->getValue(); + switch (val) + { + case 0: + mParticleDetailField->setCaption("low"); + break; + case 1: + mParticleDetailField->setCaption("medium"); + break; + case 2: + mParticleDetailField->setCaption("high"); + break; + case 3: + mParticleDetailField->setCaption("max"); + break; + } + config.setValue("particleEmitterSkip", 3 - val); + Particle::emitterSkip = 4 - val; + } else if (event.getId() == "fpslimitcheckbox") { if (mFpsCheckBox->isSelected()) diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 095fdbd6..a0701a3c 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -78,6 +78,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Slider *mOverlayDetailSlider; gcn::Label *mOverlayDetailField; + int mParticleDetail; + gcn::Slider *mParticleDetailSlider; + gcn::Label *mParticleDetailField; + void updateSliders(bool originalValues); -- cgit v1.2.3-70-g09d2