1.在.h中声明一些方法
virtual void keyBackClicked(); //Android返回键
bool isHaveSaveFile();
void getHighestHistoryScore();
在.cpp中实现这个几个方法
void WelcomeLayer::keyBackClicked()2.写一个单例,单例区分工厂例。
public:
static PlaneLayer*sharePlane;
static PlaneLayer*create();
PlaneLayer*PlaneLayer::sharePlane=NULL;
PlaneLayer*PlaneLayer::create(){
PlaneLayer*pRet=new PlaneLayer();
if(pRet&&pRet->init()){
pRet->autorelease();
sharePlane=pRet;
return pRet;
}
else{
CC_SAFE_DELETE(pRet);
pRet=NULL;
return pRet;
}
}
3.一组搭配的屏幕触摸操作
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
void registerWithTouchDispatcher(); //单点触控