我使用cocostudio制作了一个骨骼动画,这个动画列表里边有两个动画
第一个动画时循环播放
第二个动画只播放一次,是在触发事件时播放,播放完成后要停止此动画
现在动画播放都没问题,但是在win32平台下,当给Armature设置回调就会报错
armature->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(GameScene::collisionFinish));
这里初始化动画,播放动画列表的第一个动画,win32下也没问题
//初始化机械手臂
void GameScene::initCatchHand(){
catchHandArmature = Armature::create("CatchHandAnim");
catchHandArmature->getAnimation()->play("readyanim");
catchHandArmature->setLocalZOrder(6);
catchHandArmature->setScale(1.0f);
catchHandArmature->setAnchorPoint(Vec2(0.5f, 0.0f));
catchHandArmature->setPosition(Vec2(origin.x + visibleSize.width/2 - 80, origin.y + visibleSize.height - 250));
this->addChild(catchHandArmature);
}
```
当触发事件时播放第二个动画,并为armature设置回调,播放完动画停止动画,win32就会报错,Android平台正常
{
....
catchHandArmature->getAnimation()->play("catchanim");
catchHandArmature->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(GameScene::collisionFinish));
....
}
```
这是我的回调函数
//动画完成后的回调事件,在win32下运行会出现问题!
void GameScene::collisionFinish(){
catchHandArmature->getAnimation()->stop();
}
```
执行到回调函数就报错;
不过在Android平台下却运行正常!
报错内容:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
希望各位高手帮忙看下!