1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include "HelloWorldScene.h" Scene* HelloWorld::createScene() { auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene; } bool HelloWorld::init() { if (!Layer::init()) { return false; } auto spr = Sprite::create("ball.png"); spr->setPosition(Point(100, 100)); this->addChild(spr); auto action_0 = MoveTo::create(3.0, Point(400, 100)); auto action_1 = DelayTime::create(3.0); auto action_2 = CallFuncN::create(CC_CALLBACK_1(HelloWorld::setCallFunc_1, this)); //콜 펑션은 메소드를 호출하는 액션으로 조합 액션에서 주로 사용됩니다. auto action_3 = Sequence::create(action_0, action_1, action_2, NULL); spr->runAction(action_3); return true; } void HelloWorld::setCallFunc_0() { CCLOG("HelloWorld::setCallFunc_0()"); } void HelloWorld::setCallFunc_1(Ref *sender) { CCLOG("HelloWorld::setCallFunc_1()"); auto spr = (Sprite*)sender; spr->setScale(2.0); } void HelloWorld::setCallFunc_2(Ref *sender, void *d) { CCLOG("HelloWorld::setCallFunc_2()"); } void HelloWorld::setCallFunc_3(Ref *sender, Ref *object) { CCLOG("HelloWorld::setCallFunc_3()"); } |