TouchDispatcherが使えなくなっているようで、代わりにEventListenerというものが実装されていました。
下記のようにコードを変更したら動きました。
CCScrollLayer.h
class CCScrollLayer : public Layer
{
protected:
EventListenerTouch *m_listener;
CCScrollLayer.cpp
bool CCScrollLayer::initWithLayers(Array *layers, int widthOffset)
{
if (Layer::init())
{
// Make sure the layer accepts touches
// Director::getInstance()->getTouchDispatcher()->addTargetedDelegate(this,0,true);
m_listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE);
m_listener->onTouchBegan = CC_CALLBACK_2(CCScrollLayer::onTouchBegan, this);
m_listener->onTouchMoved = CC_CALLBACK_2(CCScrollLayer::onTouchMoved, this);
m_listener->onTouchEnded = CC_CALLBACK_2(CCScrollLayer::onTouchEnded, this);
m_listener->onTouchCancelled = CC_CALLBACK_2(CCScrollLayer::onTouchCancelled, this);
EventDispatcher::getInstance()->addEventListenerWithSceneGraphPriority(m_listener, this);
(略)
}
void CCScrollLayer::onExit()
{
// Director::getInstance()->getTouchDispatcher()->removeDelegate(this);
EventDispatcher::getInstance()->removeEventListener(m_listener);
Layer::onExit();
}
または、こちらの方法でも動くようです。
Layerの場合だけだと思われますが、こちらのほうが簡単でいいですね。
CCScrollLayer.cpp
bool CCScrollLayer::initWithLayers(Array *layers, int widthOffset)
{
if (Layer::init())
{
// Make sure the layer accepts touches
// Director::getInstance()->getTouchDispatcher()->addTargetedDelegate(this,0,true);
setTouchEnabled(true);
setTouchMode(Touch::DispatchMode::ONE_BY_ONE);