Help us understand the problem. What is going on with this article?

setTouchEnabledがDeprecatedって言われたけどんじゃどうするんじゃい

More than 5 years have passed since last update.

正解:イベントリスナーを設定してあげる。
\パパーン/

TouchLayer.cpp
bool TouchLayer::init(){
//TouchOneByOneの他にTouchAllAtOne(複数タッチ)もあるお!
auto listener = EventListenerTouchOneByOne::create();
//でもAllAtOnceならonTouch"es"Beganになる。
 listener->onTouchBegan = CC_CALLBACK_2(TouchLayer::onTouchBegan, this);
 listener->onTouchMoved = CC_CALLBACK_2(TouchLayer::onTouchMoved, this);
 listener->onTouchEnded = CC_CALLBACK_2(TouchLayer::onTouchEnded, this);


//cocos2d-x3.0からは見たまんまのタッチの優先度とかに設定できるから便利だよね。
this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
}

なんかObjectiveCのprotocol作ってDelegate設定し直してるみたいな感じよね。ラムダ式とか
簡単な処理なら突っ込んでもできそうだけども。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした