Difference between below 2 is that 1st code is passing “function” but 2nd is passing “function call”.
CCCallFunc::create(CC_CALLBACK_0(GamePlay::EnemyRotatingAnimationCallback,this))
CCCallFunc::create(CC_CALLBACK_0(GamePlay::EnemyRotatingAnimationCallback(5),this))
CC_CALLBACK_0 is MACRO which expects a callback fn along with infinite arguments. But these arguments shouldn’t be having any placeholder(C++ std:bind accept placeholders). CC_CALLBACK_1 is MACRO which accepts callback function along with infinite arguments but with 1 placeholder… Nothing to do with how many arguments your callback function accepts(which is EnemyRotatingAnimationCallback in your case, can u plz shorten the name to atleastEnemyRotatingAnimationCb!)
By infinite arguments, I meant, as many as your callback function accepts. Otherwise, it will give error in C++ and will ignore extra parameters if working on JS
READ both below:
// new callbacks based on C++11
#define CC_CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__)
#define CC_CALLBACK_1(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, ##__VA_ARGS__)
#define CC_CALLBACK_2(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__)
#define CC_CALLBACK_3(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, ##__VA_ARGS__)
If not understand, let me know.