cocos2d-x CCTouchDispatcher - no sharedDispatcher

c++, cocos2d-iphone, cocos2d-x

Solution

If you are using 2.0, they have been merged in to CCDirector. please use

            CCDirector::sharedDirector()->getTouchDispatcher()

Problem

I'm currently porting an ObjC cocos2d game to cocos2d-x, but I'm encountering some problems when trying to create a registerWithTouchDispatcher method, at the moment I'm doing ``` void GameLayer::registerWithTouchDispatcher() { CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true); } ``` but this gives an error 'No member named sharedDispatcher' in cocos2d::CCTouchDispatcher'. Is there another way that this must be done in cocos2d-x?

Original source