- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我试图在一系列动画之后设置一个 Action ,基本上我需要使用一个对象(我想作为参数传递)作为一个方法。
我发现的唯一方法是使用 CCCallFunc,它(据我所知)不应该有参数。
是否存在一种 cocos2d/objective-c 的“callBlock”?这是一个很棒的工具,我想知道是否有类似cocos2d-x的东西
代码如下:
CCCallFuncND *callBack = CCCallFuncND::create(this, callfuncND_selector(MyObject::method), data);
因为我试图在一个只有静态函数的类(未初始化)中完成它,所以我不能使用“this”所以我试图将它设置为 NULL 但在这种情况下我得到了一个错误...
最佳答案
我必须做同样的事情,在运行一系列 Action 之后:我想从 bacthNode 中删除 Sprite ,这样我的动画帧就不会在动画结束时出现在屏幕上,所以我必须将批处理节点传递给功能,这就是我实现它的方式:-
CCSequence *seq=CCSequence::createWithTwoActions(
CCAnimate::create(animation),
CCCallFuncO::create(
animation,
callfuncO_selector(GameLayer::animationReshuffleFinished),
(CCObject*)animBatchNode)
);
您需要的函数是 CCCallFuncO 而不是 ND,这里 O 代表 Object。
CCCallFuncO::create(
animation,
callfuncO_selector(GameLayer::animationReshuffleFinished),
(CCObject*)animBatchNode)
animation
是我的 CCAnimate 对象animationReshuffleFinished
是我的类 GameLayer 的回调函数,我想在动画结束时调用它。并且 (CCObject*)animBatchNode)
是函数 animationReshuffleFinished 的参数
这里是函数的定义
void GameLayer::animationReshuffleFinished(CCObject *sender){
CCSpriteBatchNode *animBatchNode = (CCSpriteBatchNode*) sender;
animBatchNode->cocos2d::CCNode::removeAllChildrenWithCleanup(true);
}
请让我知道这是否符合您的目的。
关于c++ - cocos2dx。如何在动画序列之后设置回调(传递参数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19990389/
我无法从主题做一个场景。 我安装了 DirectX 2009 年 3 月 9 日的 SDK,它是 9,“sub”-version c,但是“sub-sub”-version 是 41,所以库 (d3d
我的团队和我一直在努力解决我们在进入 Beta 版之前尝试混淆我们的 Android 应用程序时遇到的异常。 我们得到的异常是: Error:Uncaught translation error: c
我在将同事的 Android 源代码编译为 APK 时遇到问题。这是控制台中显示的错误 :app:transformClassesWithDexForDebug AGPBI: {"kind":"err
我最近在尝试为 Android 构建 apk 时遇到了我的 Azure CI 管道问题。 我收到以下错误: Build-tool 31.0.0 is missing DX at /usr/local/
我的 HelloWorld.java 中有以下代码: public class HelloWorld { public static void main(String[] args) {
我的 Android 应用程序使用了大量非常重要的外部库。这些库都是用 Java 编写的,并简单地添加到构建路径中。 从 Eclipse 中启动应用程序需要很长时间,大约 5 分钟。这非常令人沮丧!
所以我的问题有点简单。我有一个顶点缓冲区,我用创建它 pDevice->CreateVertexBuffer( m_dwCount * sizeof(CUSTOMVERTEX)
eclipse 中有没有办法将参数传递给 dx(--no-optimize 等)以提高 dx 处理速度? 最佳答案 创建少于 300 行的方法,在我创建了一个 2000 行的方法之前,在 Dx 处理中
有没有关于“dx”的文档? 我特别想知道 --core-library 选项的作用。 最佳答案 什么是“dx”工具? dx 工具将 Java 类文件转换为 *.dex(Dalvik 可执行文件)* 文
我目前正在为x86汇编学习考试。 我没有太多运气来搜索“:”,这太常见了标点符号:/ IDIV - Signed Integer Division Usage: IDIV src Modifies f
我有一个输出 jcamp-dx (*.jdx) 文件的仪器。有我可以用来查看数据的软件,但我宁愿用它做一些其他事情,比如在网页上绘制它,这在我必须访问数据的软件中是不允许的。 数据文件是纯文本,但它们
我正在尝试根据是否选中复选框来设置按钮的启用/禁用。下面是我的 javascript 和 asp 代码,它不起作用。我不确定是否根本没有调用该函数,或者我禁用按钮的方式有问题。 function O
我需要从命令行构建我的 android 应用程序(我正在使用 Java7 编译代码),但是当我尝试创建 dex 文件时出现以下错误 trouble processing: bad class file
我尝试使用这段代码缩放矩阵: D3DXMATRIX & rMatrix = m_Matrices[i]; D3DXMatrixScaling(&rMatrix, 2.0
最近我又回到了 C++ 中。我已经离开 C++/CLI 而使用 C# 至少一年了,我有点生疏了。我正在查看适用于 Windows 8 的 Direct3D 应用程序的基本示例,但找不到任何可以解释
当我在 eclipse ADT 中运行 android 应用程序时,“Dx 写入输出时遇到问题:已经准备好”出现在控制台中,然后应用程序照常运行。出现此消息的原因是什么?我该如何解决? 最佳答案 我遇
我想使用 C++ 进行插件开发。在开发 VST 或 DX 之间犹豫不决。有什么考虑?我知道有些主机更容易支持一种或另一种格式(Cubase:VSTs,Cakewalk:DXs),但这就是我所知道的。
我正在尝试根据类型可视化一些评分,但是我很难找到如何根据类型对系列进行分组。 图表选项如下: $scope.chartOptions = { dataSource: data,
如何为 d/d(n*x) 运算符生成模板? 我正在编写一个需要计算图像中线导数的程序。如果我们想计算关于 d/dx 的最简单的导数近似,我们可以运行以下操作: diff[x] = -1.0 * ima
我使用 dev extreme Angular 应用程序中的 UI 框架。 在文档中我找到了如何设置 focus 它说使用 method focus() 但是DxTextBoxComponent中没有
我是一名优秀的程序员,十分优秀!