AniTapGestureRecognizer.h
1.04 KB
//
// AniTapGestureRecognizer.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 02.07.2017.
//
//
#ifndef AniTapGestureRecognizer_h
#define AniTapGestureRecognizer_h
#include "AniGestureRecognizer.h"
class AniTapGestureRecognizer : public AniGestureRecognizer
{
public:
AniTapGestureRecognizer();
virtual void setOnTapDetectedCallback(std::function<void(cocos2d::Point touchLocation)> callback);
protected:
std::function<void(cocos2d::Point touchLocation)> _onTapDetectedCallback;
const double MAX_DELTA_TIME = 0.6;
const double MAX_DELTA_LOCATION = 20;
// helper temp vars
double _startTime;
cocos2d::Point _startLocation;
//////
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 /* AniTapGestureRecognizer_h */