X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Finput%2Fbinarycontrol.h;h=0d71bdc3349e0dc4afedf3a5a9423528ca82977a;hb=479298192e3e5b71a402f79520c90372a4c4b504;hp=8a156f78981fc5d2c60970305237f682af1e979c;hpb=1023b38fa278cea71fba3d2881e1bfde930cd025;p=libs%2Fgui.git diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h index 8a156f7..0d71bdc 100644 --- a/source/input/binarycontrol.h +++ b/source/input/binarycontrol.h @@ -18,24 +18,27 @@ public: sigc::signal signal_release; private: - bool state; - float threshold; + bool state = false; + float threshold = 0.5f; public: - BinaryControl(); + BinaryControl() = default; BinaryControl(const ControlSource &); BinaryControl(Device &, ControlSrcType, unsigned); + ~BinaryControl(); /** Sets the threshold between states for axis sources. No effect on button sources */ void set_threshold(float); bool get_state() const { return state; } + bool was_pressed() const { return rising_edge; } + bool was_released() const { return falling_edge; } private: - virtual void on_press(); - virtual void on_release(); - virtual void on_motion(float, float); + void on_press() override; + void on_release() override; + void on_motion(float, float) override; }; } // namespace Input