issue #2430:move TransitionScene enum into class

This commit is contained in:
minggo 2013-07-25 20:50:39 +08:00
parent df48f52aa3
commit 051caf5e54
6 changed files with 66 additions and 66 deletions

View File

@ -148,4 +148,9 @@ const int kCCTouchesAllAtOnce = Layer::TOUCHES_ALL_AT_ONCE;
const int kCCImageFormatPNG = Image::FORMAT_PNG;
const int kCCImageFormatJPEG = Image::FORMAT_JPG;
const int kCCTransitionOrientationLeftOver = TransitionScene::ORIENTATION_LEFT_OVER;
const int kCCTransitionOrientationRightOver = TransitionScene::ORIENTATION_RIGHT_OVER;
const int kCCTransitionOrientationUpOver = TransitionScene::ORIENTATION_UP_OVER;
const int kCCTransitionOrientationDownOver = TransitionScene::ORIENTATION_DOWN_OVER;
NS_CC_END

View File

@ -906,10 +906,11 @@ CC_DEPRECATED_ATTRIBUTE extern const int kCCImageFormatPNG;
CC_DEPRECATED_ATTRIBUTE extern const int kCCImageFormatJPEG;
CC_DEPRECATED_ATTRIBUTE typedef enum Image::Format tImageFormat;
#define kCCTransitionOrientationLeftOver kTransitionOrientationLeftOver
#define kCCTransitionOrientationRightOver kTransitionOrientationRightOver
#define kCCTransitionOrientationUpOver kTransitionOrientationUpOver
#define kCCTransitionOrientationDownOver kTransitionOrientationDownOver
CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationLeftOver;
CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationRightOver;
CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationUpOver;
CC_DEPRECATED_ATTRIBUTE extern const int kCCTransitionOrientationDownOver;
CC_DEPRECATED_ATTRIBUTE typedef enum TransitionScene::Orientation tOrientation;
#define kCCPrioritySystem kPrioritySystem
#define kCCPriorityNonSystemMin kPriorityNonSystemMin

View File

@ -206,7 +206,7 @@ TransitionSceneOriented::~TransitionSceneOriented()
{
}
TransitionSceneOriented * TransitionSceneOriented::create(float t, Scene *scene, tOrientation orientation)
TransitionSceneOriented * TransitionSceneOriented::create(float t, Scene *scene, Orientation orientation)
{
TransitionSceneOriented * pScene = new TransitionSceneOriented();
pScene->initWithDuration(t,scene,orientation);
@ -214,7 +214,7 @@ TransitionSceneOriented * TransitionSceneOriented::create(float t, Scene *scene,
return pScene;
}
bool TransitionSceneOriented::initWithDuration(float t, Scene *scene, tOrientation orientation)
bool TransitionSceneOriented::initWithDuration(float t, Scene *scene, Orientation orientation)
{
if ( TransitionScene::initWithDuration(t, scene) )
{
@ -740,7 +740,7 @@ void TransitionFlipX::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation == kTransitionOrientationRightOver )
if( _orientation == TransitionScene::ORIENTATION_RIGHT_OVER )
{
inDeltaZ = 90;
inAngleZ = 270;
@ -776,7 +776,7 @@ void TransitionFlipX::onEnter()
_outScene->runAction(outA);
}
TransitionFlipX* TransitionFlipX::create(float t, Scene* s, tOrientation o)
TransitionFlipX* TransitionFlipX::create(float t, Scene* s, Orientation o)
{
TransitionFlipX* pScene = new TransitionFlipX();
pScene->initWithDuration(t, s, o);
@ -787,7 +787,7 @@ TransitionFlipX* TransitionFlipX::create(float t, Scene* s, tOrientation o)
TransitionFlipX* TransitionFlipX::create(float t, Scene* s)
{
return TransitionFlipX::create(t, s, kTransitionOrientationRightOver);
return TransitionFlipX::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
//
@ -810,7 +810,7 @@ void TransitionFlipY::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation == kTransitionOrientationUpOver )
if( _orientation == TransitionScene::ORIENTATION_UP_OVER )
{
inDeltaZ = 90;
inAngleZ = 270;
@ -846,7 +846,7 @@ void TransitionFlipY::onEnter()
}
TransitionFlipY* TransitionFlipY::create(float t, Scene* s, tOrientation o)
TransitionFlipY* TransitionFlipY::create(float t, Scene* s, Orientation o)
{
TransitionFlipY* pScene = new TransitionFlipY();
pScene->initWithDuration(t, s, o);
@ -857,7 +857,7 @@ TransitionFlipY* TransitionFlipY::create(float t, Scene* s, tOrientation o)
TransitionFlipY* TransitionFlipY::create(float t, Scene* s)
{
return TransitionFlipY::create(t, s, kTransitionOrientationUpOver);
return TransitionFlipY::create(t, s, TransitionScene::ORIENTATION_UP_OVER);
}
//
@ -881,7 +881,7 @@ void TransitionFlipAngular::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation == kTransitionOrientationRightOver )
if( _orientation == TransitionScene::ORIENTATION_RIGHT_OVER )
{
inDeltaZ = 90;
inAngleZ = 270;
@ -916,7 +916,7 @@ void TransitionFlipAngular::onEnter()
_outScene->runAction(outA);
}
TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s, tOrientation o)
TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s, Orientation o)
{
TransitionFlipAngular* pScene = new TransitionFlipAngular();
pScene->initWithDuration(t, s, o);
@ -927,7 +927,7 @@ TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s, tOrienta
TransitionFlipAngular* TransitionFlipAngular::create(float t, Scene* s)
{
return TransitionFlipAngular::create(t, s, kTransitionOrientationRightOver);
return TransitionFlipAngular::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
//
@ -950,7 +950,7 @@ void TransitionZoomFlipX::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation == kTransitionOrientationRightOver ) {
if( _orientation == TransitionScene::ORIENTATION_RIGHT_OVER ) {
inDeltaZ = 90;
inAngleZ = 270;
outDeltaZ = 90;
@ -994,7 +994,7 @@ void TransitionZoomFlipX::onEnter()
_outScene->runAction(outA);
}
TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s, tOrientation o)
TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s, Orientation o)
{
TransitionZoomFlipX* pScene = new TransitionZoomFlipX();
pScene->initWithDuration(t, s, o);
@ -1005,7 +1005,7 @@ TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s, tOrientation
TransitionZoomFlipX* TransitionZoomFlipX::create(float t, Scene* s)
{
return TransitionZoomFlipX::create(t, s, kTransitionOrientationRightOver);
return TransitionZoomFlipX::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
//
@ -1029,7 +1029,7 @@ void TransitionZoomFlipY::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation== kTransitionOrientationUpOver ) {
if( _orientation== TransitionScene::ORIENTATION_UP_OVER ) {
inDeltaZ = 90;
inAngleZ = 270;
outDeltaZ = 90;
@ -1073,7 +1073,7 @@ void TransitionZoomFlipY::onEnter()
_outScene->runAction(outA);
}
TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s, tOrientation o)
TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s, Orientation o)
{
TransitionZoomFlipY* pScene = new TransitionZoomFlipY();
pScene->initWithDuration(t, s, o);
@ -1084,7 +1084,7 @@ TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s, tOrientation
TransitionZoomFlipY* TransitionZoomFlipY::create(float t, Scene* s)
{
return TransitionZoomFlipY::create(t, s, kTransitionOrientationUpOver);
return TransitionZoomFlipY::create(t, s, TransitionScene::ORIENTATION_UP_OVER);
}
//
@ -1108,7 +1108,7 @@ void TransitionZoomFlipAngular::onEnter()
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
if( _orientation == kTransitionOrientationRightOver ) {
if( _orientation == TransitionScene::ORIENTATION_RIGHT_OVER ) {
inDeltaZ = 90;
inAngleZ = 270;
outDeltaZ = 90;
@ -1154,7 +1154,7 @@ void TransitionZoomFlipAngular::onEnter()
_outScene->runAction(outA);
}
TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s, tOrientation o)
TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s, Orientation o)
{
TransitionZoomFlipAngular* pScene = new TransitionZoomFlipAngular();
pScene->initWithDuration(t, s, o);
@ -1165,7 +1165,7 @@ TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s,
TransitionZoomFlipAngular* TransitionZoomFlipAngular::create(float t, Scene* s)
{
return TransitionZoomFlipAngular::create(t, s, kTransitionOrientationRightOver);
return TransitionZoomFlipAngular::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
//

View File

@ -56,31 +56,25 @@ public:
virtual ActionInterval * easeActionWithAction(ActionInterval * action) = 0;
};
/** Orientation Type used by some transitions
*/
typedef enum {
/// An horizontal orientation where the Left is nearer
kTransitionOrientationLeftOver = 0,
/// An horizontal orientation where the Right is nearer
kTransitionOrientationRightOver = 1,
/// A vertical orientation where the Up is nearer
kTransitionOrientationUpOver = 0,
/// A vertical orientation where the Bottom is nearer
kTransitionOrientationDownOver = 1,
// Deprecated
// kOrientationLeftOver = kTransitionOrientationLeftOver,
// kOrientationRightOver = kTransitionOrientationRightOver,
// kOrientationUpOver = kTransitionOrientationUpOver,
// kOrientationDownOver = kTransitionOrientationDownOver,
} tOrientation;
/** @brief Base class for Transition scenes
*/
class CC_DLL TransitionScene : public Scene
{
public:
/** Orientation Type used by some transitions
*/
enum Orientation
{
/// An horizontal orientation where the Left is nearer
ORIENTATION_LEFT_OVER = 0,
/// An horizontal orientation where the Right is nearer
ORIENTATION_RIGHT_OVER = 1,
/// A vertical orientation where the Up is nearer
ORIENTATION_UP_OVER = 0,
/// A vertical orientation where the Bottom is nearer
ORIENTATION_DOWN_OVER = 1,
};
/** creates a base transition with duration and incoming scene */
static TransitionScene * create(float t, Scene *scene);
@ -125,16 +119,16 @@ class CC_DLL TransitionSceneOriented : public TransitionScene
{
public:
/** creates a base transition with duration and incoming scene */
static TransitionSceneOriented * create(float t,Scene* scene, tOrientation orientation);
static TransitionSceneOriented * create(float t,Scene* scene, Orientation orientation);
TransitionSceneOriented();
virtual ~TransitionSceneOriented();
/** initializes a transition with duration and incoming scene */
bool initWithDuration(float t,Scene* scene,tOrientation orientation);
bool initWithDuration(float t,Scene* scene,Orientation orientation);
protected:
tOrientation _orientation;
Orientation _orientation;
};
/** @brief TransitionRotoZoom:
@ -345,7 +339,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionFlipX : public TransitionSceneOriented
{
public:
static TransitionFlipX* create(float t, Scene* s, tOrientation o);
static TransitionFlipX* create(float t, Scene* s, Orientation o);
static TransitionFlipX* create(float t, Scene* s);
TransitionFlipX();
@ -364,7 +358,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionFlipY : public TransitionSceneOriented
{
public:
static TransitionFlipY* create(float t, Scene* s, tOrientation o);
static TransitionFlipY* create(float t, Scene* s, Orientation o);
static TransitionFlipY* create(float t, Scene* s);
TransitionFlipY();
@ -383,7 +377,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionFlipAngular : public TransitionSceneOriented
{
public:
static TransitionFlipAngular* create(float t, Scene* s, tOrientation o);
static TransitionFlipAngular* create(float t, Scene* s, Orientation o);
static TransitionFlipAngular* create(float t, Scene* s);
TransitionFlipAngular();
@ -402,7 +396,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionZoomFlipX : public TransitionSceneOriented
{
public:
static TransitionZoomFlipX* create(float t, Scene* s, tOrientation o);
static TransitionZoomFlipX* create(float t, Scene* s, Orientation o);
static TransitionZoomFlipX* create(float t, Scene* s);
TransitionZoomFlipX();
@ -421,7 +415,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionZoomFlipY : public TransitionSceneOriented
{
public:
static TransitionZoomFlipY* create(float t, Scene* s, tOrientation o);
static TransitionZoomFlipY* create(float t, Scene* s, Orientation o);
static TransitionZoomFlipY* create(float t, Scene* s);
TransitionZoomFlipY();
@ -440,7 +434,7 @@ The front face is the outgoing scene and the back face is the incoming scene.
class CC_DLL TransitionZoomFlipAngular : public TransitionSceneOriented
{
public:
static TransitionZoomFlipAngular* create(float t, Scene* s, tOrientation o);
static TransitionZoomFlipAngular* create(float t, Scene* s, Orientation o);
static TransitionZoomFlipAngular* create(float t, Scene* s);
TransitionZoomFlipAngular();

View File

@ -18,7 +18,7 @@ class FlipXLeftOver : public TransitionFlipX
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipX::create(t, s, kTransitionOrientationLeftOver);
return TransitionFlipX::create(t, s, TransitionScene::ORIENTATION_LEFT_OVER);
}
};
@ -27,7 +27,7 @@ class FlipXRightOver : public TransitionFlipX
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipX::create(t, s, kTransitionOrientationRightOver);
return TransitionFlipX::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
};
@ -36,7 +36,7 @@ class FlipYUpOver : public TransitionFlipY
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipY::create(t, s, kTransitionOrientationUpOver);
return TransitionFlipY::create(t, s, TransitionScene::ORIENTATION_UP_OVER);
}
};
@ -45,7 +45,7 @@ class FlipYDownOver : public TransitionFlipY
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipY::create(t, s, kTransitionOrientationDownOver);
return TransitionFlipY::create(t, s, TransitionScene::ORIENTATION_DOWN_OVER);
}
};
@ -54,7 +54,7 @@ class FlipAngularLeftOver : public TransitionFlipAngular
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipAngular::create(t, s, kTransitionOrientationLeftOver);
return TransitionFlipAngular::create(t, s, TransitionScene::ORIENTATION_LEFT_OVER);
}
};
@ -63,7 +63,7 @@ class FlipAngularRightOver : public TransitionFlipAngular
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionFlipAngular::create(t, s, kTransitionOrientationRightOver);
return TransitionFlipAngular::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
};
@ -72,7 +72,7 @@ class ZoomFlipXLeftOver : public TransitionZoomFlipX
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipX::create(t, s, kTransitionOrientationLeftOver);
return TransitionZoomFlipX::create(t, s, TransitionScene::ORIENTATION_LEFT_OVER);
}
};
@ -81,7 +81,7 @@ class ZoomFlipXRightOver : public TransitionZoomFlipX
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipX::create(t, s, kTransitionOrientationRightOver);
return TransitionZoomFlipX::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
};
@ -90,7 +90,7 @@ class ZoomFlipYUpOver : public TransitionZoomFlipY
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipY::create(t, s, kTransitionOrientationUpOver);
return TransitionZoomFlipY::create(t, s, TransitionScene::ORIENTATION_UP_OVER);
}
};
@ -100,7 +100,7 @@ class ZoomFlipYDownOver : public TransitionZoomFlipY
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipY::create(t, s, kTransitionOrientationDownOver);
return TransitionZoomFlipY::create(t, s, TransitionScene::ORIENTATION_DOWN_OVER);
}
};
@ -109,7 +109,7 @@ class ZoomFlipAngularLeftOver : public TransitionZoomFlipAngular
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipAngular::create(t, s, kTransitionOrientationLeftOver);
return TransitionZoomFlipAngular::create(t, s, TransitionScene::ORIENTATION_LEFT_OVER);
}
};
@ -118,7 +118,7 @@ class ZoomFlipAngularRightOver : public TransitionZoomFlipAngular
public:
static TransitionScene* create(float t, Scene* s)
{
return TransitionZoomFlipAngular::create(t, s, kTransitionOrientationRightOver);
return TransitionZoomFlipAngular::create(t, s, TransitionScene::ORIENTATION_RIGHT_OVER);
}
};

View File

@ -1 +1 @@
7d50f253cea22341bb12287a99918976bed6425e
c3c76f4aefbb1eec7509aa23febcdfb254b54313