mirror of https://github.com/axmolengine/axmol.git
fixed #1368: Implement EffectsAdvancedTest (Effect4). Added some comments.
This commit is contained in:
parent
c3fce65f7f
commit
86942aedb4
|
@ -140,6 +140,11 @@ public:
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Lens3DTarget()
|
||||||
|
: m_pLens3D(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
CCLens3D* m_pLens3D;
|
CCLens3D* m_pLens3D;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,10 +157,17 @@ void Effect4::onEnter()
|
||||||
CCActionInterval* move_back = move->reverse();
|
CCActionInterval* move_back = move->reverse();
|
||||||
CCActionInterval* seq = (CCActionInterval *)(CCSequence::create( move, move_back, NULL));
|
CCActionInterval* seq = (CCActionInterval *)(CCSequence::create( move, move_back, NULL));
|
||||||
|
|
||||||
|
/* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target.
|
||||||
|
While in cocos2d-x, the target of action only supports CCNode or its subclass,
|
||||||
|
so we make an encapsulation for CCLens3D to achieve that.
|
||||||
|
*/
|
||||||
|
|
||||||
CCDirector* director = CCDirector::sharedDirector();
|
CCDirector* director = CCDirector::sharedDirector();
|
||||||
CCNode* pTarget = Lens3DTarget::create(lens);
|
CCNode* pTarget = Lens3DTarget::create(lens);
|
||||||
|
// Please make sure the target been added to its parent.
|
||||||
|
this->addChild(pTarget);
|
||||||
|
|
||||||
director->getActionManager()->addAction(seq, pTarget, false);
|
director->getActionManager()->addAction(seq, pTarget, false);
|
||||||
addChild(pTarget);
|
|
||||||
this->runAction( lens );
|
this->runAction( lens );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue