9

When I try to call [CCTouchDispatcher sharedDispatcher];, it shows an error that the class method sharedDispatcher is missing. I go to the .h file of CCTouchDispatcher and found that sharedDispatcher is really missing! I am using Cocos2D 2.0 beta2. Is it removed from this version? If so what should I use to replace it. (may be [[CCTouchDispatcher alloc] init])

Hlung
  • 13,850
  • 6
  • 71
  • 90

2 Answers2

15

Just found an answer here https://stackoverflow.com/a/9059809/467588. You have to use this instead...

[[CCDirector sharedDirector] touchDispatcher]

I will still post this question anyway because that one's title is not comprehensive and hard to search, or until its owner accept my edit :)

Community
  • 1
  • 1
Hlung
  • 13,850
  • 6
  • 71
  • 90
4

Same applies to Cocos-2D-X 2.0

pre 2.0: CCTouchDispatcher::sharedDispatcher();

since 2.0: CCDirector::sharedDirector()->getTouchDispatcher();

Simple, once you've figured it out... ;)

Gaylord Zach
  • 121
  • 1
  • 3