Cocos2d-x OneBy OneTouch 기본 Code
1393 단어 cocos2dx

먼저
scene.cpp-->file
//touch listener set
auto touchListener=EventListenerTouchOneByOne::create();
//set touch
touchListener->setEnabled(true);
// touchbegan
touchListener->onTouchBegan = CC_CALLBACK_2(Scene::onTouchBegan,this);
touchListener->onTouchMoved = CC_CALLBACK_2(Scene::onTouchMoved,this);
touchListener->onTouchEnded = CC_CALLBACK_2(Scene::onTouchEnded,this);
touchListener->onTouchEnded = CC_CALLBACK_2(Scene::onTouchCancelled,this);
//set dispatcher
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
scene.h-->file bool onTouchBegan(cocos2d::Touch *touch,cocos2d::Event *event);
//onTouchMoved
void onTouchMoved(cocos2d::Touch *touch,cocos2d::Event *event);
//onTouchEnded
void onTouchEnded(cocos2d::Touch *touch,cocos2d::Event *event);
//onTouchCancelled
void onTouchCancelled(cocos2d::Touch *touch,cocos2d::Event *event);

Reference
이 문제에 관하여(Cocos2d-x OneBy OneTouch 기본 Code), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/MavisVermilion/items/f7aadd8d44a888bab376텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)