X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fbinarycontrol.h;h=4331f05aa94371b8337ce3ffc1b97fc748c7805c;hb=daf317db7a79a4c92880042125814ca942c3a6fa;hp=44aaef4214b98ddd0153aeb359f52a1e3a94c39e;hpb=fcd5f24311fcfe772825a75678e038749401a9be;p=libs%2Fgui.git diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h index 44aaef4..4331f05 100644 --- a/source/input/binarycontrol.h +++ b/source/input/binarycontrol.h @@ -15,8 +15,7 @@ namespace Input { /** A control with two possible states. Button state is mapped directly. An axis -is considered to be active when its value is above a threshold (defined by the -input device). +is considered to be active when its value is within 10% of the end of the axis. */ class BinaryControl: public Control { @@ -26,11 +25,19 @@ public: private: bool state; + float threshold; public: BinaryControl(); BinaryControl(const ControlSource &); BinaryControl(Device &, ControlSrcType, unsigned); + + /** + Sets the threshold between states for axis sources. No effect on button + sources + */ + void set_threshold(float); + bool get_state() const { return state; } private: