X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fgesturedetector.h;h=fdd083de0372feb7cb4cde113881f6175d1e27cb;hb=a5be5c703808817dda8feafb03b0aec04b20afbb;hp=2b5ea3c3203219d2153b78cd22e19c65aed3d291;hpb=f9ebab54c3debe98e108790be9c21f43f4de116f;p=libs%2Fgui.git diff --git a/source/input/gesturedetector.h b/source/input/gesturedetector.h index 2b5ea3c..fdd083d 100644 --- a/source/input/gesturedetector.h +++ b/source/input/gesturedetector.h @@ -11,22 +11,24 @@ class Touchscreen; enum Gesture { GESTURE_NONE, - GESTURE_SWIPE_DOWN, - GESTURE_SWIPE_UP, - GESTURE_SWIPE_LEFT, - GESTURE_SWIPE_RIGHT, + GESTURE_DRAG, GESTURE_PINCH }; /** Interprets events from a Touchscreen as high-level gestures. One button is provided for each type of gesture. Axes 0 and 1 indicate the starting position -of the gesture; axis 2 tracks its progress. The progress axis may exhibit +of the gesture; axes 2 and 3 track its progress. The progress axis may exhibit absolute values greater than one. */ class GestureDetector: public Device { private: + enum + { + MAX_POINTS = 3 + }; + struct TouchPoint { bool down; @@ -34,12 +36,13 @@ private: float down_y; float x; float y; + bool threshold_exceeded; TouchPoint(); }; Touchscreen &touchscreen; - TouchPoint points[3]; + TouchPoint points[MAX_POINTS]; Gesture current_gesture; unsigned active_points; bool invalid_gesture; @@ -58,6 +61,7 @@ private: void touch_move(unsigned, float, float); void start_gesture(); void update_progress(); + void end_gesture(); void window_resized(unsigned, unsigned); };