本篇的主题就是揭露CC_CALLBACK 与 std::bind之间不可告人的秘密......
首先看一段代码:
- //先是创建3个精灵
- boy=Sprite::create("boy.png");//创建boy
- boy->setPosition(Point(visibleSize.width/2,visibleSize.height/2));
- this->addChild(boy,1);
- girl_1=Sprite::create("girl_1.png");//创建girl1
- girl_1->setPosition(Point(visibleSize.width/3,248)"> girl_1->setTag(10);
- this->addChild(girl_1,1);
- girl_2=Sprite::create("girl_3.png");//创建girl2
- girl_2->setPosition(Point(2*visibleSize.width/3,visibleSize.height/2));
- girl_2->setTag(20);
- this->addChild(girl_2,248)"> //让boy运动,通过Callfunc回调到callback1
- boy->runAction(CCSequence::create(MoveBy::create(1.0f,Point(0,100)),
- CallFunc::create(CC_CALLBACK_0(HelloWorld::callback1,this)),
- NULL));