Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/audiosettingsmenu.cc40
-rw-r--r--src/client/audiosettingsmenu.h7
2 files changed, 45 insertions, 2 deletions
diff --git a/src/client/audiosettingsmenu.cc b/src/client/audiosettingsmenu.cc
index d247cbe..07a1009 100644
--- a/src/client/audiosettingsmenu.cc
+++ b/src/client/audiosettingsmenu.cc
@@ -7,6 +7,7 @@
#include "client/audiosettingsmenu.h"
#include "core/cvar.h"
#include "ui/button.h"
+#include "ui/checkbox.h"
#include "ui/slider.h"
#include "ui/iconbutton.h"
#include "ui/inputbox.h"
@@ -68,6 +69,19 @@ AudioSettingsMenu::AudioSettingsMenu(ui::Widget *parent, const char *label) : ui
_enginevolumeslider->set_border(true);
_enginevolumeslider->set_range(0.0f, 100.0f);
+
+ // doppler effect
+ _optionslabel = new ui::Label(_frame);
+ _optionslabel->set_label("options");
+ _optionslabel->set_background(false);
+ _optionslabel->set_border(false);
+ _optionslabel->set_text("Options");
+
+ _dopplercheckbox = new ui::Checkbox(_frame);
+ _dopplercheckbox->set_label("snd_doppler");
+ _dopplercheckbox->set_text("Enable doppler effect (requires sound restart)");
+ _dopplercheckbox->set_border(true);
+
// apply button
_applybutton = new ui::Button(_frame, "Apply");
@@ -118,6 +132,17 @@ void AudioSettingsMenu::refresh()
{
_enginevolumeslider->set_value(0.0f);
}
+
+ // doppler effect
+ if (core::Cvar *cv_doppler = core::Cvar::find("snd_doppler"))
+ {
+ float v = cv_doppler->value();
+ _dopplercheckbox->set_value(v > 0.0f);
+ }
+ else
+ {
+ _dopplercheckbox->set_value(false);
+ }
}
void AudioSettingsMenu::apply()
@@ -135,6 +160,13 @@ void AudioSettingsMenu::apply()
float v = _enginevolumeslider->value();
cv_engines->assign(v * 0.01f);
}
+
+ // set doppler effect
+ if (core::Cvar *cv_doppler = core::Cvar::find("snd_doppler"))
+ {
+ float v = (_dopplercheckbox->value() ? 1.0f : 0.0f);
+ cv_doppler->assign(v * 0.01f);
+ }
}
void AudioSettingsMenu::resize()
@@ -170,6 +202,14 @@ void AudioSettingsMenu::resize()
_enginevolumeslider->set_location(_enginevolumelabel->right() + padding, _enginevolumelabel->top());
_enginevolumeslider->set_size(_frame->width() - _enginevolumelabel->right() - 2.0f * padding, _enginevolumelabel->height());
+ // options label
+ _optionslabel->set_location(padding, _enginevolumelabel->bottom() + margin);
+ _optionslabel->set_size(ui::UI::elementsize.width(), _optionslabel->font()->height() + margin);
+
+ // doppler effect checkbox
+ _dopplercheckbox->set_location(_optionslabel->right() + padding, _optionslabel->top());
+ _dopplercheckbox->set_size(_enginevolumeslider->width(), _optionslabel->height());
+
// resize apply button
_applybutton->set_size(ui::UI::elementsize);
_applybutton->set_location(
diff --git a/src/client/audiosettingsmenu.h b/src/client/audiosettingsmenu.h
index 8aef1ae..9c9e83e 100644
--- a/src/client/audiosettingsmenu.h
+++ b/src/client/audiosettingsmenu.h
@@ -12,10 +12,10 @@
namespace ui
{
class Button;
+ class Checkbox;
class IconButton;
class Label;
- class Slider;
-
+ class Slider;
}
namespace client
@@ -75,6 +75,9 @@ private:
ui::Label *_enginevolumelabel;
ui::Slider *_enginevolumeslider;
+ ui::Label *_optionslabel;
+ ui::Checkbox *_dopplercheckbox;
+
ui::Button *_applybutton;
ui::Button *_resetbutton;
};