HelloWorld.cpp
[cpp]
init(){
//------------------------------------------------------------------
- Armature *armature = Armature::create( "Hero");
- armature->setPosition(ccp(visibleSize.width * 0.5, visibleSize.height * 0.3));
- armature->getAnimation()->playWithIndex(1);
- this->addChild(armature);
-
- armature->getBone("head")->getDisplayRenderNode()->setColor(Color3B::RED);
-
- armature->getAnimation()->setFrameEventCallFunc(this,frameEvent_selector(HelloWorld::onFrameEvent));
- armature->getAnimation()->play("attack");
-
- }
-
- void HelloWorld::onFrameEvent(Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
- {
- //
evt.c_str() 系 帧事件的名称 - log("----- %s, --- %d
--- %d" ,evt.c_str(),originFrameIndex,currentFrameIndex); - }
http://blog.sina.com.cn/s/blog_6d193c030101hbya.html