2011-03-19 10:59:01 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010-2011 cocos2d-x.org
|
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
2011-07-01 11:26:26 +08:00
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2011-03-19 10:59:01 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCTRANSITION_H__
|
|
|
|
#define __CCTRANSITION_H__
|
|
|
|
|
|
|
|
#include "CCScene.h"
|
|
|
|
namespace cocos2d {
|
|
|
|
|
|
|
|
//static creation function macro
|
|
|
|
//c/c++ don't support object creation of using class name
|
|
|
|
//so, all classes need creation method.
|
2010-08-20 14:35:37 +08:00
|
|
|
#define DECLEAR_TRANSITIONWITHDURATION(_Type)\
|
2011-03-19 10:59:01 +08:00
|
|
|
static _Type* transitionWithDuration(ccTime t, CCScene* scene);
|
|
|
|
|
2012-03-26 16:46:23 +08:00
|
|
|
#define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
|
|
|
|
_Type* _Type::transitionWithDuration(ccTime t, CCScene* scene)\
|
|
|
|
{\
|
|
|
|
_Type* pScene = new _Type();\
|
|
|
|
if(pScene && pScene->initWithDuration(t, scene)){\
|
|
|
|
pScene->autorelease();\
|
|
|
|
return pScene;}\
|
|
|
|
CC_SAFE_DELETE(pScene);\
|
|
|
|
return NULL;\
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-19 10:59:01 +08:00
|
|
|
class CCActionInterval;
|
|
|
|
class CCNode;
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCTransitionEaseScene can ease the actions of the scene protocol.
|
2010-07-08 18:11:08 +08:00
|
|
|
@since v0.8.2
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionEaseScene// : public CCObject
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-09-28 12:14:12 +08:00
|
|
|
public:
|
2010-07-08 18:11:08 +08:00
|
|
|
/** returns the Ease action that will be performed on a linear action.
|
|
|
|
@since v0.8.2
|
|
|
|
*/
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action) = 0;
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
2011-03-19 10:59:01 +08:00
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
/** Orientation Type used by some transitions
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
/// An horizontal orientation where the Left is nearer
|
|
|
|
kOrientationLeftOver = 0,
|
|
|
|
/// An horizontal orientation where the Right is nearer
|
|
|
|
kOrientationRightOver = 1,
|
|
|
|
/// A vertical orientation where the Up is nearer
|
|
|
|
kOrientationUpOver = 0,
|
|
|
|
/// A vertical orientation where the Bottom is nearer
|
|
|
|
kOrientationDownOver = 1,
|
2011-03-19 10:59:01 +08:00
|
|
|
} tOrientation;
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief Base class for CCTransition scenes
|
2011-03-19 10:59:01 +08:00
|
|
|
*/
|
|
|
|
class CC_DLL CCTransitionScene : public CCScene
|
|
|
|
{
|
|
|
|
|
|
|
|
protected:
|
2010-07-12 17:56:06 +08:00
|
|
|
CCScene * m_pInScene;
|
|
|
|
CCScene * m_pOutScene;
|
2010-07-08 18:11:08 +08:00
|
|
|
ccTime m_fDuration;
|
2010-07-12 17:56:06 +08:00
|
|
|
bool m_bIsInSceneOnTop;
|
2011-03-19 10:59:01 +08:00
|
|
|
bool m_bIsSendCleanupToScene;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CCTransitionScene();
|
|
|
|
virtual ~CCTransitionScene();
|
|
|
|
virtual void draw();
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onExit();
|
|
|
|
virtual void cleanup();
|
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
/** creates a base transition with duration and incoming scene */
|
2010-08-03 11:28:34 +08:00
|
|
|
static CCTransitionScene * transitionWithDuration(ccTime t, CCScene *scene);
|
2010-07-08 18:11:08 +08:00
|
|
|
|
|
|
|
/** initializes a transition with duration and incoming scene */
|
2010-09-04 12:02:52 +08:00
|
|
|
virtual bool initWithDuration(ccTime t,CCScene* scene);
|
2010-07-08 18:11:08 +08:00
|
|
|
|
|
|
|
/** called after the transition finishes */
|
|
|
|
void finish(void);
|
|
|
|
|
|
|
|
/** used by some transitions to hide the outter scene */
|
2011-03-19 10:59:01 +08:00
|
|
|
void hideOutShowIn(void);
|
|
|
|
|
|
|
|
protected:
|
2010-07-12 18:20:04 +08:00
|
|
|
virtual void sceneOrder();
|
2011-03-19 10:59:01 +08:00
|
|
|
private:
|
|
|
|
void setNewScene(ccTime dt);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief A CCTransition that supports orientation like.
|
2010-07-08 18:11:08 +08:00
|
|
|
* Possible orientation: LeftOver, RightOver, UpOver, DownOver
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSceneOriented : public CCTransitionScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
protected:
|
2010-08-18 11:06:48 +08:00
|
|
|
tOrientation m_eOrientation;
|
2010-07-08 18:11:08 +08:00
|
|
|
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSceneOriented();
|
|
|
|
virtual ~CCTransitionSceneOriented();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
/** creates a base transition with duration and incoming scene */
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionSceneOriented * transitionWithDuration(ccTime t,CCScene* scene, tOrientation orientation);
|
2010-07-08 18:11:08 +08:00
|
|
|
/** initializes a transition with duration and incoming scene */
|
2010-09-04 12:02:52 +08:00
|
|
|
virtual bool initWithDuration(ccTime t,CCScene* scene,tOrientation orientation);
|
2011-03-19 10:59:01 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionRotoZoom:
|
2010-07-08 18:11:08 +08:00
|
|
|
Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionRotoZoom : public CCTransitionScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionRotoZoom();
|
|
|
|
virtual ~CCTransitionRotoZoom();
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionRotoZoom);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionJumpZoom:
|
2010-07-08 18:11:08 +08:00
|
|
|
Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionJumpZoom : public CCTransitionScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionJumpZoom();
|
|
|
|
virtual ~CCTransitionJumpZoom();
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionJumpZoom);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionMoveInL:
|
2010-07-08 18:11:08 +08:00
|
|
|
Move in from to the left the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionMoveInL : public CCTransitionScene, public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionMoveInL();
|
|
|
|
virtual ~CCTransitionMoveInL();
|
2010-07-08 18:11:08 +08:00
|
|
|
/** initializes the scenes */
|
|
|
|
virtual void initScenes(void);
|
|
|
|
/** returns the action that will be performed */
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInL);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionMoveInR:
|
2010-07-08 18:11:08 +08:00
|
|
|
Move in from to the right the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionMoveInR : public CCTransitionMoveInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionMoveInR();
|
|
|
|
virtual ~CCTransitionMoveInR();
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void initScenes();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInR);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionMoveInT:
|
2010-07-08 18:11:08 +08:00
|
|
|
Move in from to the top the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionMoveInT : public CCTransitionMoveInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionMoveInT();
|
|
|
|
virtual ~CCTransitionMoveInT();
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void initScenes();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInT);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionMoveInB:
|
2010-07-08 18:11:08 +08:00
|
|
|
Move in from to the bottom the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionMoveInB : public CCTransitionMoveInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionMoveInB();
|
|
|
|
virtual ~CCTransitionMoveInB();
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void initScenes();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInB);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSlideInL:
|
2010-07-08 18:11:08 +08:00
|
|
|
Slide in the incoming scene from the left border.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSlideInL : public CCTransitionScene, public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSlideInL();
|
|
|
|
virtual ~CCTransitionSlideInL();
|
2010-07-09 18:24:08 +08:00
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
/** initializes the scenes */
|
|
|
|
virtual void initScenes(void);
|
|
|
|
/** returns the action that will be performed by the incomming and outgoing scene */
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-07-12 18:20:04 +08:00
|
|
|
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInL);
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
|
|
|
virtual void sceneOrder();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSlideInR:
|
2010-07-08 18:11:08 +08:00
|
|
|
Slide in the incoming scene from the right border.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSlideInR : public CCTransitionSlideInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSlideInR();
|
|
|
|
virtual ~CCTransitionSlideInR();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
/** initializes the scenes */
|
|
|
|
virtual void initScenes(void);
|
|
|
|
/** returns the action that will be performed by the incomming and outgoing scene */
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInR);
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void sceneOrder();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSlideInB:
|
2010-07-08 18:11:08 +08:00
|
|
|
Slide in the incoming scene from the bottom border.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSlideInB : public CCTransitionSlideInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSlideInB();
|
|
|
|
virtual ~CCTransitionSlideInB();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
/** initializes the scenes */
|
|
|
|
virtual void initScenes(void);
|
|
|
|
/** returns the action that will be performed by the incomming and outgoing scene */
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInB);
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void sceneOrder();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSlideInT:
|
2010-07-08 18:11:08 +08:00
|
|
|
Slide in the incoming scene from the top border.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSlideInT : public CCTransitionSlideInL
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSlideInT();
|
|
|
|
virtual ~CCTransitionSlideInT();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
/** initializes the scenes */
|
|
|
|
virtual void initScenes(void);
|
|
|
|
/** returns the action that will be performed by the incomming and outgoing scene */
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInT);
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void sceneOrder();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2010-09-29 09:44:57 +08:00
|
|
|
@brief Shrink the outgoing scene while grow the incoming scene
|
2010-07-08 18:11:08 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionShrinkGrow : public CCTransitionScene , public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionShrinkGrow();
|
|
|
|
virtual ~CCTransitionShrinkGrow();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionShrinkGrow);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFlipX:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen horizontally.
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFlipX : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFlipX();
|
|
|
|
virtual ~CCTransitionFlipX();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFlipY:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen vertically.
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFlipY : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFlipY();
|
|
|
|
virtual ~CCTransitionFlipY();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFlipAngular:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen half horizontally and half vertically.
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFlipAngular : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFlipAngular();
|
|
|
|
virtual ~CCTransitionFlipAngular();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionZoomFlipX:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen horizontally doing a zoom out/in
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionZoomFlipX : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionZoomFlipX();
|
|
|
|
virtual ~CCTransitionZoomFlipX();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionZoomFlipY:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen vertically doing a little zooming out/in
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionZoomFlipY : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionZoomFlipY();
|
|
|
|
virtual ~CCTransitionZoomFlipY();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionZoomFlipAngular:
|
2010-07-08 18:11:08 +08:00
|
|
|
Flips the screen half horizontally and half vertically doing a little zooming out/in.
|
|
|
|
The front face is the outgoing scene and the back face is the incoming scene.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionZoomFlipAngular : public CCTransitionSceneOriented
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionZoomFlipAngular();
|
|
|
|
virtual ~CCTransitionZoomFlipAngular();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFade:
|
2010-07-08 18:11:08 +08:00
|
|
|
Fade out the outgoing scene and then fade in the incoming scene.'''
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFade : public CCTransitionScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
protected:
|
2010-07-14 16:30:25 +08:00
|
|
|
ccColor4B m_tColor;
|
2010-07-08 18:11:08 +08:00
|
|
|
|
|
|
|
public:
|
2010-07-09 18:24:08 +08:00
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFade();
|
|
|
|
virtual ~CCTransitionFade();
|
2010-07-09 18:24:08 +08:00
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
/** creates the transition with a duration and with an RGB color
|
2010-09-28 12:14:12 +08:00
|
|
|
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
|
2010-07-08 18:11:08 +08:00
|
|
|
*/
|
2011-08-17 21:19:57 +08:00
|
|
|
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, const ccColor3B& color = ccBLACK);
|
2010-07-08 18:11:08 +08:00
|
|
|
/** initializes the transition with a duration and with an RGB color */
|
2011-08-17 21:19:57 +08:00
|
|
|
virtual bool initWithDuration(ccTime t, CCScene*scene ,const ccColor3B& color);
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-09-04 12:02:52 +08:00
|
|
|
virtual bool initWithDuration(ccTime t,CCScene* scene);
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onExit();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-09-29 16:33:52 +08:00
|
|
|
class CCRenderTexture;
|
2010-07-08 18:11:08 +08:00
|
|
|
/**
|
2010-12-27 09:40:45 +08:00
|
|
|
@brief CCTransitionCrossFade:
|
2010-07-08 18:11:08 +08:00
|
|
|
Cross fades two scenes using the CCRenderTexture object.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionCrossFade : public CCTransitionScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public :
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionCrossFade();
|
|
|
|
virtual ~CCTransitionCrossFade();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void draw();
|
|
|
|
virtual void onEnter();
|
|
|
|
virtual void onExit();
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionCrossFade);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionTurnOffTiles:
|
2010-07-08 18:11:08 +08:00
|
|
|
Turn off the tiles of the outgoing scene in random order
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionTurnOffTiles : public CCTransitionScene ,public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public :
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionTurnOffTiles();
|
|
|
|
virtual ~CCTransitionTurnOffTiles();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
|
|
|
virtual void onEnter();
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
2010-09-14 15:23:38 +08:00
|
|
|
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionTurnOffTiles);
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
|
|
|
virtual void sceneOrder();
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSplitCols:
|
2010-07-08 18:11:08 +08:00
|
|
|
The odd columns goes upwards while the even columns goes downwards.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSplitCols : public CCTransitionScene , public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSplitCols();
|
|
|
|
virtual ~CCTransitionSplitCols();
|
2010-07-09 18:24:08 +08:00
|
|
|
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void onEnter();
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitCols);
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionSplitRows:
|
2010-07-08 18:11:08 +08:00
|
|
|
The odd rows goes to the left while the even rows goes to the right.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionSplitRows : public CCTransitionSplitCols
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionSplitRows();
|
|
|
|
virtual ~CCTransitionSplitRows();
|
2010-07-12 17:56:06 +08:00
|
|
|
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* action(void);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitRows)
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFadeTR:
|
2010-07-08 18:11:08 +08:00
|
|
|
Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransitionEaseScene
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFadeTR();
|
|
|
|
virtual ~CCTransitionFadeTR();
|
2011-08-17 21:19:57 +08:00
|
|
|
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
|
2010-07-12 17:56:06 +08:00
|
|
|
virtual void onEnter();
|
2010-12-22 15:43:54 +08:00
|
|
|
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeTR)
|
2010-07-12 18:20:04 +08:00
|
|
|
protected:
|
|
|
|
virtual void sceneOrder();
|
|
|
|
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFadeBL:
|
2010-07-08 18:11:08 +08:00
|
|
|
Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFadeBL();
|
|
|
|
virtual ~CCTransitionFadeBL();
|
2011-08-17 21:19:57 +08:00
|
|
|
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL)
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFadeUp:
|
2010-07-08 18:11:08 +08:00
|
|
|
* Fade the tiles of the outgoing scene from the bottom to the top.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFadeUp();
|
|
|
|
virtual ~CCTransitionFadeUp();
|
2011-08-17 21:19:57 +08:00
|
|
|
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp)
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
|
|
|
|
2010-12-27 09:40:45 +08:00
|
|
|
/** @brief CCTransitionFadeDown:
|
2010-07-08 18:11:08 +08:00
|
|
|
* Fade the tiles of the outgoing scene from the top to the bottom.
|
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR
|
2010-07-08 18:11:08 +08:00
|
|
|
{
|
2010-07-09 18:24:08 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
CCTransitionFadeDown();
|
|
|
|
virtual ~CCTransitionFadeDown();
|
2011-08-17 21:19:57 +08:00
|
|
|
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2010-09-14 15:23:38 +08:00
|
|
|
public:
|
2010-12-27 09:40:45 +08:00
|
|
|
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown)
|
2010-07-08 18:11:08 +08:00
|
|
|
};
|
2011-03-19 10:59:01 +08:00
|
|
|
}//namespace cocos2d
|
2010-07-08 18:11:08 +08:00
|
|
|
|
2010-07-09 18:24:08 +08:00
|
|
|
#endif // __CCTRANSITION_H__
|
|
|
|
|