ATTRIB(Slider, colorC, vector, '1 1 1');
ATTRIB(Slider, colorF, vector, '1 1 1');
ATTRIB(Slider, disabledAlpha, float, 0.3);
+ ATTRIB(Slider, onChange, void(entity, entity));
+ ATTRIB(Slider, onChangeEntity, entity);
ENDCLASS(Slider)
#include "checkbox.qh"
#include "inputbox.qh"
+void updateSensSlider(entity field, entity slider)
+{
+ XonoticSlider_setValue(slider, stof(field.text));
+}
+
+void updateSensField(entity slider, entity field)
+{
+ if (slider.value)
+ SUPER(XonoticInputBox).setText(field, ftos_mindecimals(stof((sprintf("%0.4f", slider.value)))));
+ // don't use that to avoid infinite onChange looping, just steal its content
+ //XonoticInputBox_setText(field, ftos(slider.value));
+}
+
+void linkSensitivities(entity slider, entity field)
+{
+ slider.onChange = updateSensField;
+ slider.onChangeEntity = field;
+
+ field.onChange = updateSensSlider;
+ field.onChangeEntity = slider;
+}
+
entity makeXonoticInputSettingsTab()
{
entity me;
me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Mouse")));
me.TR(me);
+ entity sensitivitySlider;
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Sensitivity:")));
- me.TD(me, 1, 2, e = makeXonoticInputBox_T(0, "sensitivity",
+ me.TD(me, 1, 1.5, e = makeXonoticSlider_T(0.1, 9.9, 0.1, "sensitivity",
+ _("Mouse speed multiplier")));
+ sensitivitySlider = e;
+ e.fontSize = 0;
+ me.currentColumn -= 0.35;
+ me.TD(me, 1, 1, e = makeXonoticInputBox_T(0, "sensitivity",
_("Mouse speed multiplier")));
+ e.saveImmediately = 1;
+ linkSensitivities(sensitivitySlider, e);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "m_filter", _("Smooth aiming"),
_("Smoothes the mouse movement, but makes aiming slightly less responsive")));