I use cocos2d-x 3.0 RC1, and I have the following question. As I knew, cocos2d-x had a single (centralized) event dispatcher, and it was implemented as a singleton so that I could send event from everywhere to anywhere. Now in the final version it is not a singleton and I cannot use EventDispatcher::getInstance()
. Why the centralized EventDispatcher was considered wrong? In this case how I can send an event from a class that is not a cocos2d::Node
to another class that is not a cocos2d::Node
either?
Got the answer:
cocos2d::Director::getInstance()->getEventDispatcher();