]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/gesturedetector.h
Use constexpr instead of enum to define "typeless" constants
[libs/gui.git] / source / input / gesturedetector.h
index 51af312720c17da85a4f49692a6116c9022ab5bf..0b31fd8c1c23aff34aad6914c0d23634566a6cdd 100644 (file)
@@ -30,10 +30,7 @@ absolute values greater than one.
 class GestureDetector: public Device
 {
 private:
-       enum
-       {
-               MAX_POINTS = 3
-       };
+       static constexpr size_t MAX_POINTS = 3;
 
        struct TouchPoint
        {
@@ -49,17 +46,17 @@ private:
 
        Touchscreen &touchscreen;
        TouchPoint points[MAX_POINTS];
-       Gesture current_gesture;
-       Gesture pending_tap;
-       bool invalid_gesture;
-       float threshold_x_sq;
-       float threshold_y_sq;
+       Gesture current_gesture = GESTURE_NONE;
+       Gesture pending_tap = GESTURE_NONE;
+       bool invalid_gesture = false;
+       float threshold_x_sq = 1.0f;
+       float threshold_y_sq = 1.0f;
 
 public:
        GestureDetector(Touchscreen &);
 
-       virtual std::string get_button_name(unsigned) const;
-       virtual std::string get_axis_name(unsigned) const;
+       std::string get_button_name(unsigned) const override;
+       std::string get_axis_name(unsigned) const override;
 
 private:
        void touch_down(unsigned);