namespace Input {
BinaryControl::BinaryControl():
- state(false)
+ state(false),
+ threshold(0.5)
{ }
BinaryControl::BinaryControl(const ControlSource &s):
Control(s),
- state(false)
+ state(false),
+ threshold(0.5)
{ }
BinaryControl::BinaryControl(Device &d, ControlSrcType t, unsigned i):
Control(d, t, i),
- state(false)
+ state(false),
+ threshold(0.5)
{ }
+void BinaryControl::set_threshold(float t)
+{
+ threshold=t;
+}
+
void BinaryControl::on_press()
{
if(!state)
void BinaryControl::on_motion(float value, float)
{
- if(value>src.dev->get_axis_threshold())
+ if(value>threshold)
on_press();
else
on_release();