Reputation: 444
Can some body find me a way how can i pass argument while making scheduler call in cocos2d or cocos2dx? I'm using this scheduler call and passing it parameter by a class variable. I want to send parameter through this call. Thanks!
scheduler->scheduleSelector(schedule_selector(CFacebookManager::sendRequestAllUpdateUI), CFacebookManager::instance(), 1, false, 1, 1.0f);
Upvotes: 1
Views: 3439
Reputation: 689
If you are using cocos2dx with c++11, I had to make an action that takes a lambda of code and schedules it. Lamdas can capture any number of variables, plus the action takes userData as a template, and passes it to the lambda as a pointer, so you can modify it and expect percistency across updates without declaring extra instance variables in your class. Please, check it out. https://github.com/radif/MCBCallLambda
Upvotes: 1
Reputation: 479
What you want to do isn't possible in cocos2d. You can't pass parameter's through a schedule update method.
LearnCocos2d gave a good answers to almost the same question here schedule event with multiple arguments in cocos2D
Upvotes: 1