Blame view

ios/Runner/Wowgame/Classes/game_animal/AniTapGestureRecognizer.h 1.04 KB
5daad4bc   xiaoyu   游戏源码添加编译(现存问题:游戏内...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  //
  //  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 */