X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fcontrol.h;h=f9c7003b4290ea17b8f57dfb43249b03f8489288;hb=bc1a38d6d2c966a6aee74e483ca7a7d37a56909e;hp=450b057ce30496b27f20ec251d3310163c45ae72;hpb=754d00736b05c0f07f2fe34889527f8e3013dd37;p=libs%2Fgui.git diff --git a/source/input/control.h b/source/input/control.h index 450b057..f9c7003 100644 --- a/source/input/control.h +++ b/source/input/control.h @@ -13,7 +13,7 @@ class Device; enum ControlSrcType { - NONE, + NO_SOURCE, BUTTON, AXIS_POS, AXIS_NEG @@ -25,11 +25,11 @@ different types of controls in a uniform way. */ struct ControlSource { - Device *dev; - ControlSrcType type; - unsigned index; + Device *dev = nullptr; + ControlSrcType type = NO_SOURCE; + unsigned index = 0; - ControlSource(); + ControlSource() = default; ControlSource(Device &, ControlSrcType, unsigned); std::string str() const; }; @@ -55,11 +55,13 @@ public: protected: ControlSource src; - Device *capture_dev; - BinaryControl *activator; - float origin; + Device *capture_dev = nullptr; + BinaryControl *activator = nullptr; + float origin = 0.0f; + bool rising_edge = false; + bool falling_edge = false; - Control(); + Control() = default; Control(const ControlSource &); Control(Device &, ControlSrcType, unsigned); public: @@ -72,6 +74,9 @@ public: const ControlSource &get_source() const { return src; } void set_activator(BinaryControl *); BinaryControl *get_activator() const { return activator; } + bool has_rising_edge() const { return rising_edge; } + bool has_falling_edge() const { return falling_edge; } + void reset_edges(); protected: virtual void on_press() = 0; virtual void on_release() = 0;