- #include<iostream>
- #include"cocos2d.h"
- USING_NS_CC;
- constintminSwipdistance=100;
- intminSwiptime=1000;//毫秒
- intmaxClickedDis=20;
- enumE_SWIP_DIR
- E_INVAILD,
- E_LEFT,
- E_RIGHT,255); background-color:inherit">E_UP,255); background-color:inherit">E_DOWN
- };
- classTouchTest:publicLayer
- public:
- TouchTest();
- booltouchBegan(Touch*touch,Event*event);
- voidtouchMoved(Touch*touch,Event*event);
- voidtouchEnded(Touch*touch,255); font-weight:bold; background-color:inherit">voidtouchCancel(Touch*touch,255); font-weight:bold; background-color:inherit">voidonTouchesBegan(conststd::vector<Touch*>&touches,Event*unused_event);
- voidonTouchesMoved(voidonTouchesEnded(voidonTouchesCancelled(voidupdateSingleDelay(float);
- voidupdateDoubleDelay(float);
- voidupdatelongprogress(longgetCurrentTime();
- voidstopSchedule();
- private:
- E_SWIP_DIRGetSwipDir(Pointstart,Pointend,longtimeDis);
- public:
- virtualvoidonSingleCLick();//单击
- voidonDoubleClick();//双击
- voidonThreeClick();//3连击
- voidonLongPressed();//长按
- voidonMove(Point);//移动
- voidonSwip(Point,Point,E_SWIP_DIR);//滑动