この行で、actionWithTarget メソッドが非推奨であるという警告が表示されます。cocos2dxで使用できる代替方法を教えてください
CCCallFunc *callBackfunc = CCCallFunc::actionWithTarget(this,
callfunc_selector(GamePlay::startTrumphetAnimation));
ありがとう
これを試して:
CCCallFunc *func = CCCallFunc::create(this, callfunc_selector(GameOverScene::MyFunction));
//この関数も宣言する
void GameOverScene::MyFunction(CCObject* sender)
{
}
Cocos2dx の新しいバージョンを使用している場合、
auto funcCallAction = CallFunc::create([=](){
// TODO: do you stuff here
startTrumphetAnimation();
});
runAction(funcCallAction);
これを試して
CCCallFunc *calFunc = CCCalFunc::create(this,callfunc_selector(ClassName::methodName));
cocos2dx v3 を使用している場合:
CallFunc *calFunc = CalFunc::create(CC_CALLBACK_1(ClassName::methodName,this));
void ClassName::methodName(Ref* sender)
{
}