From 33e32e987c3c70fe88c7e7d8a50f93ea64aea866 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 27 Jun 2012 18:44:25 +0800 Subject: [PATCH] Implement EffectsAdvancedTest (Effect4). --- .../EffectsAdvancedTest.cpp | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp index b00ab2b3d9..8532c32ed5 100644 --- a/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -123,22 +123,40 @@ std::string Effect3::title() // Effect4 // //------------------------------------------------------------------ + +class Lens3DTarget : public CCNode +{ +public: + virtual void setPosition(const CCPoint& var) + { + m_pLens3D->setPosition(var); + } + + static Lens3DTarget* create(CCLens3D* pAction) + { + Lens3DTarget* pRet = new Lens3DTarget(); + pRet->m_pLens3D = pAction; + pRet->autorelease(); + return pRet; + } +private: + CCLens3D* m_pLens3D; +}; + void Effect4::onEnter() { EffectAdvanceTextLayer::onEnter(); - CCActionInterval* lens = CCLens3D::create(ccp(100,180), 150, ccg(32,24), 10); - //id move = [MoveBy::create:5 position:ccp(400,0)]; + CCLens3D* lens = CCLens3D::create(ccp(100,180), 150, ccg(32,24), 10); + CCActionInterval* move = CCJumpBy::create(5, ccp(380,0), 100, 4); + CCActionInterval* move_back = move->reverse(); + CCActionInterval* seq = (CCActionInterval *)(CCSequence::create( move, move_back, NULL)); - /** - @todo we only support CCNode run actions now. - */ -// CCActionInterval* move = CCJumpBy::create(5, ccp(380,0), 100, 4); -// CCActionInterval* move_back = move->reverse(); -// CCActionInterval* seq = (CCActionInterval *)(CCSequence::create( move, move_back, NULL)); -// CCActionManager::sharedManager()->addAction(seq, lens, false); - - runAction( lens ); + CCDirector* director = CCDirector::sharedDirector(); + CCNode* pTarget = Lens3DTarget::create(lens); + director->getActionManager()->addAction(seq, pTarget, false); + addChild(pTarget); + this->runAction( lens ); } std::string Effect4::title()