// // AniLongPressGestureRecognizer.h // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 19.05.2017. // // #ifndef AniLongPressGestureRecognizer_h #define AniLongPressGestureRecognizer_h #include "AniGestureRecognizer.h" class AniLongPressGestureRecognizer : public AniGestureRecognizer { public: AniLongPressGestureRecognizer(float waitTime = 1); virtual ~AniLongPressGestureRecognizer(); virtual void setOnLongPressDetectedCallback(std::function callback); protected: std::function _onLongPressDetected; std::function _callback; // helper constant const float MAX_DELTA = 10; // helper temp vars int _waitTime; long long _startTime; cocos2d::Point _startLocation; bool _callbackScheduled; ////// virtual bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event) override; virtual void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event) override; virtual void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event) override; }; #endif /* AniLongPressGestureRecognizer_h */