#ifndef __CCPAGE_TURN_TRANSITION_H__
#define __CCPAGE_TURN_TRANSITION_H__
#include "CCTransition.h"
NS_CC_BEGIN
/**
* @addtogroup transition
* @{
*/
/**
@brief A transition which peels back the bottom right hand corner of a scene
to transition to the scene beneath it simulating a page turn.
This uses a 3DAction so it's strongly recommended that depth buffering
is turned on in CCDirector using:
CCDirector::sharedDirector()->setDepthBufferFormat(kDepthBuffer16);
@since v0.8.2
*/
class CC_DLL CCTransitionPageTurn : public CCTransitionScene
{
protected:
bool m_bBack;
public:
CCTransitionPageTurn();
virtual ~CCTransitionPageTurn();
/**
* Creates a base transition with duration and incoming scene.
* If back is true then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene.
*/
static CCTransitionPageTurn* create(float t,CCScene* scene,bool backwards);
/**
* Creates a base transition with duration and incoming scene.
* If back is true then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene.
*/
virtual bool initWithDuration(float t,CCScene* scene,bool backwards);
CCActionInterval* actionWithSize(const CCSize& vector);
virtual void onEnter();
{
CCTransitionScene::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
int x,y;
if (s.width > s.height)
{
x=16;
y=12;
}
else
{
x=12;
y=16;
}
CCActionInterval *action = this->actionWithSize(CCSizeMake(x,y));
if (! m_bBack )
{
m_pOutScene->runAction
(
CCSequence::create
(
action,
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
}
else
{
// to prevent initial flicker
m_pInScene->setVisible(false);
m_pInScene->runAction
(
CCSequence::create
(
CCShow::create(),
action,
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
}
}
protected:
virtual void sceneOrder();
};
// end of transition group
/// @}
NS_CC_END
#endif // __CCPAGE_TURN_TRANSITION_H__