我忘了我这篇测试的主要目的是干啥了...。

就算往项目上靠靠吧,我项目里面要用到CCArmature这个,给这个实现单指拖拽,双指缩放功能。

新建类MyArmature,和MySprite类似,如下:

MyArmature.h

 1 //
 2 //  MyArmature.h
 3 //  TouchesTest
 4 //
 5 //  Created by HanHongmin on 13-12-29.
 6 //
 7 //
 8 
 9 #ifndef __TouchesTest__MyArmature__
10 #define __TouchesTest__MyArmature__
11 
12 #include "cocos2d.h"
13 #include "cocos-ext.h"
14 using namespace cocos2d;
15 using namespace cocos2d::extension;
16 class MyArmature:public CCArmature,public CCTouchDelegate{
17 public:
18     static MyArmature* create(const char* name,int nPriority);
19     
20     virtual void onEnter();
21     virtual void onExit();
22     void draw();//for Test
23     
24     // optional
25     virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
26     virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
27     virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
28     virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
29     void setPriority(int nPriority);
30     int getPriority();
31 protected:
32     int _nPriority;
33 };
34 
35 #endif /* defined(__TouchesTest__MyArmature__) */
View Code

相关文章:

  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
相关资源
相似解决方案