]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/smoothcontrol.h
Normalize device axis ranges to [-1, 1]
[libs/gui.git] / source / input / smoothcontrol.h
index 26484a912c4a2b0615a47bc45d0b6376a919d4db..2e964bd32c62784cb9370e7cfa34cec69b27d6c5 100644 (file)
@@ -19,7 +19,7 @@ or 0.  Axis values are mapped to absolute value.
 
 Two smooth controls can also be paired to each other.  Motion on one control of
 the pair will cause negative motion on the other.  This works best when the
-controls are bound to the opposite sides of the same joystick axis.
+controls are bound to the opposite sides of the same axis.
 */
 class SmoothControl: public Control
 {
@@ -29,14 +29,21 @@ public:
 private:
        float value;
        SmoothControl *paired_ctrl;
+       float dead_zone;
+       float threshold;
 
 public:
        SmoothControl();
        SmoothControl(const ControlSource &);
        SmoothControl(Device &, ControlSrcType, unsigned);
-       SmoothControl &operator=(const SmoothControl &);
        virtual ~SmoothControl();
 
+       /// Sets the dead zone value.  Any value below this will be treated as 0.
+       void set_dead_zone(float);
+
+       /// Sets the max-out threshold.  Any value above this will be treated as 1.
+       void set_threshold(float);
+
        void pair(SmoothControl *ctrl);
        float get_value() const { return value; }