1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cocos2d-x OneByOneTouch基本Code

Last updated at Posted at 2015-07-05

19420874_m_Part2X2.jpg TouchOneByOne メモ

まず
scene.cpp-->file

   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);

:open_mouth: 完了〜

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?