如何在cocos2dx 3.0中调用callfunc函数 [英] How to call callfunc function in cocos2dx 3.0

查看:998
本文介绍了如何在cocos2dx 3.0中调用callfunc函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将客观c ++转换为C ++ 11.我坚持使用以下语法。
我在testcpp中引用并尝试以下语法。

I have to convert objective c++ to C++ 11. I have stuck with the following syntax. I have referred in testcpp and try the following syntax.

这里我尝试的代码:

this->runAction
(
 Sequence::create
 (
  blink,
  CallFunc::create(CC_CALLBACK_0(Hero::stopBlinking, NULL)),    -> issue this line.
  NULL
  )
 );

它显示错误没有匹配的函数调用'bind' CallFunc :: create。
任何人都可以帮助或帮助我。

It shows error "no matching function for call to 'bind'" in "CallFunc::create". Can any one assist or help me.

推荐答案

在您的代码中,只需替换以下代码:

In your coding, just replace the below code:

 CallFuncN::create(CC_CALLBACK_1(Hero::stopBlinking,this));

因为

 CallFunc can be created with an @std::function<void()>  
 CallFuncN can be created with an @std::function<void(Node*)

请参阅:

http:// www .cocos2d-x.org / wiki / Release_Notes_for_Cocos2d-x_v300 / diff / 5

这篇关于如何在cocos2dx 3.0中调用callfunc函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆