Jordan Lim wrote:
I am still trying to learn cocos2dx and it seems that while programming, i use alot of different selectors in my codes.
So there is like
Rather than following tutorials blindly, i wish that someone can clarify all these selectors for me.
In Objective-C, you can use single type SEL and
@selector() (on errors, application will crash or throw exception).
C++ have more robust type checks, so each
*_selector types declares which arguments such method should have. You can look at exact declarations in CCObject.h, for example, SEL_CallFuncO declared as:
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);In this case, you should pass method that accepts 1 argument of type CCObject**, and returns nothing.
void RaceScene::parseDictionary(CCObject *dicObject);
CCCallFuncO *func = CCCallFuncO::create(callfuncO_selector(RaceScene::parseDictionary), dic);Of course, “dic” has type
CCDictionary *, it will be casted to
CCObject *, and you should manually cast it back to CCDictionary** inside