mirror of https://github.com/axmolengine/axmol.git
Merge branch 'natural-law-upto-0.99.5' into upto-0.99.5
This commit is contained in:
commit
28a3857f95
|
@ -22,7 +22,6 @@ actions/CCActionPageTurn3D.cpp \
|
|||
actions/CCActionProgressTimer.cpp \
|
||||
actions/CCActionTiledGrid.cpp \
|
||||
base_nodes/CCAtlasNode.cpp \
|
||||
base_nodes/CCNode.cpp \
|
||||
cocoa/CGAffineTransform.cpp \
|
||||
cocoa/CGGeometry.cpp \
|
||||
cocoa/NSAutoreleasePool.cpp \
|
||||
|
@ -36,12 +35,10 @@ effects/CCGrid.cpp \
|
|||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
layers_scenes_transitions_nodes/CCPageTurnTransition.cpp \
|
||||
layers_scenes_transitions_nodes/CCRadialTransition.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionRadial.cpp \
|
||||
layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransition.cpp \
|
||||
menu_nodes/CCMenu.cpp \
|
||||
menu_nodes/CCMenuItem.cpp \
|
||||
misc_nodes/CCMotionStreak.cpp \
|
||||
misc_nodes/CCProgressTimer.cpp \
|
||||
|
@ -51,6 +48,9 @@ particle_nodes/CCParticleExamples.cpp \
|
|||
particle_nodes/CCParticleSystem.cpp \
|
||||
particle_nodes/CCPointParticleSystem.cpp \
|
||||
particle_nodes/CCQuadParticleSystem.cpp \
|
||||
platform/CCLayer_mobile.cpp \
|
||||
platform/CCMenu_mobile.cpp \
|
||||
platform/CCNode_mobile.cpp \
|
||||
platform/android/CCTime.cpp \
|
||||
platform/android/ccxCommon_android.cpp \
|
||||
platform/android/CCXApplication_android.cpp \
|
||||
|
|
|
@ -44,7 +44,7 @@ All features from CCNode are valid, plus the following new features:
|
|||
- It can receive iPhone Touches
|
||||
- It can receive Accelerometer input
|
||||
*/
|
||||
class CCX_DLL CCLayer : public CCNode, public CCTouchDelegate, public UIAccelerometerDelegate, public CCKeypadDelegate
|
||||
class CCX_DLL CCLayer : public CCNode, public CCTouchDelegate, public UIAccelerometerDelegate, public CCKeypadDelegate, public CCKeyboardEventDelegate, public CCMouseEventDelegate
|
||||
{
|
||||
public:
|
||||
CCLayer();
|
||||
|
@ -54,6 +54,7 @@ public:
|
|||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual void onEnterTransitionDidFinish();
|
||||
virtual bool ccTouchBegan(CCTouch *pTouch, UIEvent *pEvent);
|
||||
virtual void destroy(void);
|
||||
virtual void keep(void);
|
||||
|
@ -77,6 +78,20 @@ public:
|
|||
*/
|
||||
virtual void registerWithTouchDispatcher(void);
|
||||
|
||||
/** priority of the mouse event delegate.
|
||||
Default 0.
|
||||
Override this method to set another priority.
|
||||
@since v0.99.5
|
||||
*/
|
||||
virtual int mouseDelegatePriority() { return 0; }
|
||||
|
||||
/** priority of the keyboard event delegate.
|
||||
Default 0.
|
||||
Override this method to set another priority.
|
||||
@since v0.99.5
|
||||
*/
|
||||
virtual int keyboardDelegatePriority() { return 0; }
|
||||
|
||||
/** whether or not it will receive Touch events.
|
||||
You can enable / disable touch events with this property.
|
||||
Only the touches of this node will be affected. This "method" is not propagated to it's children.
|
||||
|
@ -88,6 +103,16 @@ public:
|
|||
@since v0.8.1
|
||||
*/
|
||||
CCX_PROPERTY(bool, m_bIsAccelerometerEnabled, IsAccelerometerEnabled)
|
||||
/** whether or not it will receive Keyboard events
|
||||
You can enable / disable Keyboard events with this property.
|
||||
@since v0.99.5
|
||||
*/
|
||||
CCX_PROPERTY(bool, m_bIsKeyboardEnabled, IsKeyboardEnabled)
|
||||
/** whether or not it will receive mouse events
|
||||
You can enable / disable mouse events with this property.
|
||||
@since v0.99.5
|
||||
*/
|
||||
CCX_PROPERTY(bool, m_bIsMouseEnabled, IsMouseEnabled)
|
||||
/** whether or not it will receive keypad events
|
||||
You can enable / disable accelerometer events with this property.
|
||||
it's new in cocos2d-x
|
||||
|
@ -96,15 +121,15 @@ public:
|
|||
};
|
||||
|
||||
//
|
||||
// CCColorLayer
|
||||
// CCLayerColor
|
||||
//
|
||||
/** @brief CCColorLayer is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
|
||||
/** @brief CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
|
||||
|
||||
All features from CCLayer are valid, plus the following new features:
|
||||
- opacity
|
||||
- RGB colors
|
||||
*/
|
||||
class CCX_DLL CCColorLayer : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol
|
||||
class CCX_DLL CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol
|
||||
{
|
||||
protected:
|
||||
GLfloat m_pSquareVertices[4 * 2];
|
||||
|
@ -112,27 +137,27 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
CCColorLayer();
|
||||
virtual ~CCColorLayer();
|
||||
CCLayerColor();
|
||||
virtual ~CCLayerColor();
|
||||
|
||||
virtual void draw();
|
||||
virtual void setContentSize(CGSize var);
|
||||
|
||||
/** creates a CCLayer with color, width and height */
|
||||
static CCColorLayer * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
/** creates a CCLayer with color, width and height in Points */
|
||||
static CCLayerColor * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
/** creates a CCLayer with color. Width and height are the window size. */
|
||||
static CCColorLayer * layerWithColor(ccColor4B color);
|
||||
static CCLayerColor * layerWithColor(ccColor4B color);
|
||||
|
||||
/** initializes a CCLayer with color, width and height */
|
||||
bool initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
/** initializes a CCLayer with color, width and height in Points */
|
||||
virtual bool initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
/** initializes a CCLayer with color. Width and height are the window size. */
|
||||
bool initWithColor(ccColor4B color);
|
||||
virtual bool initWithColor(ccColor4B color);
|
||||
|
||||
/** change width */
|
||||
/** change width in Points*/
|
||||
void changeWidth(GLfloat w);
|
||||
/** change height */
|
||||
/** change height in Points*/
|
||||
void changeHeight(GLfloat h);
|
||||
/** change width and height
|
||||
/** change width and height in Points
|
||||
@since v0.8
|
||||
*/
|
||||
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
||||
|
@ -146,8 +171,72 @@ public:
|
|||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
|
||||
private :
|
||||
void updateColor();
|
||||
protected:
|
||||
virtual void updateColor();
|
||||
};
|
||||
|
||||
/** CCColorLayer
|
||||
It is the same as CCLayerColor.
|
||||
|
||||
@deprecated Use CCLayerColor instead. This class will be removed in v1.0.1
|
||||
*/
|
||||
class CCColorLayer : public CCLayerColor
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
/** CCLayerGradient is a subclass of CCLayerColor that draws gradients across
|
||||
the background.
|
||||
|
||||
All features from CCLayerColor are valid, plus the following new features:
|
||||
- direction
|
||||
- final color
|
||||
|
||||
Color is interpolated between the startColor and endColor along the given
|
||||
vector (starting at the origin, ending at the terminus). If no vector is
|
||||
supplied, it defaults to (0, -1) -- a fade from top to bottom.
|
||||
|
||||
Given the nature of
|
||||
the interpolation, you will not see either the start or end color for
|
||||
non-cardinal vectors; a smooth gradient implying both end points will be still
|
||||
be drawn, however.
|
||||
|
||||
@since v0.99.5
|
||||
*/
|
||||
class CCLayerGradient : public CCLayerColor
|
||||
{
|
||||
public:
|
||||
/** Creates a full-screen CCLayer with a gradient between start and end. */
|
||||
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end);
|
||||
|
||||
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
|
||||
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end, CGPoint v);
|
||||
|
||||
/** Initializes the CCLayer with a gradient between start and end. */
|
||||
virtual bool initWithColor(ccColor4B start, ccColor4B end);
|
||||
|
||||
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */
|
||||
virtual bool initWithColor(ccColor4B start, ccColor4B end, CGPoint v);
|
||||
|
||||
ccColor3B getStartColor();
|
||||
void setStartColor(ccColor3B colors);
|
||||
|
||||
CCX_PROPERTY(ccColor3B, m_endColor, EndColor)
|
||||
CCX_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity)
|
||||
CCX_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity)
|
||||
CCX_PROPERTY(CGPoint, m_AlongVector, AlongVector)
|
||||
|
||||
protected:
|
||||
virtual void updateColor();
|
||||
|
||||
protected:
|
||||
ccColor3B m_endColor;
|
||||
GLubyte m_cStartOpacity;
|
||||
GLubyte m_cEndOpacity;
|
||||
CGPoint m_AlongVector;
|
||||
};
|
||||
|
||||
/** @brief CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
|
||||
|
|
|
@ -31,9 +31,14 @@ namespace cocos2d{
|
|||
|
||||
typedef enum
|
||||
{
|
||||
kMenuStateWaiting,
|
||||
kMenuStateTrackingTouch
|
||||
} MenuState;
|
||||
kCCMenuStateWaiting,
|
||||
kCCMenuStateTrackingTouch
|
||||
} tCCMenuState;
|
||||
|
||||
enum {
|
||||
//* priority used by the menu
|
||||
kCCMenuTouchPriority = -128,
|
||||
};
|
||||
|
||||
/** @brief A CCMenu
|
||||
*
|
||||
|
@ -75,16 +80,37 @@ namespace cocos2d{
|
|||
void alignItemsInRows(unsigned int rows, va_list args);
|
||||
|
||||
//super methods
|
||||
virtual CCNode * addChild(CCNode * child, int zOrder);
|
||||
virtual CCNode * addChild(CCNode * child, int zOrder, int tag);
|
||||
virtual void addChild(CCNode * child, int zOrder);
|
||||
virtual void addChild(CCNode * child, int zOrder, int tag);
|
||||
virtual void registerWithTouchDispatcher();
|
||||
|
||||
/**
|
||||
@brief For phone event handle functions
|
||||
*/
|
||||
virtual bool ccTouchBegan(CCTouch* touch, UIEvent* event);
|
||||
virtual void ccTouchEnded(CCTouch* touch, UIEvent* event);
|
||||
virtual void ccTouchCancelled(CCTouch *touch, UIEvent* event);
|
||||
virtual void ccTouchMoved(CCTouch* touch, UIEvent* event);
|
||||
|
||||
/**
|
||||
@brief For PC event handle functions
|
||||
@since v0.99.5
|
||||
*/
|
||||
virtual int mouseDelegatePriority();
|
||||
virtual CCMenuItem* itemForMouseEvent(NSEvent * pEvent);
|
||||
virtual bool ccMouseDown(NSEvent * pEvent);
|
||||
virtual bool ccMouseDragged(NSEvent * pEvent);
|
||||
virtual bool ccMouseUp(NSEvent * pEvent);
|
||||
|
||||
virtual void destroy(void);
|
||||
virtual void keep(void);
|
||||
|
||||
/**
|
||||
@since v0.99.5
|
||||
override onExit
|
||||
*/
|
||||
virtual void onExit();
|
||||
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual GLubyte getOpacity(void);
|
||||
virtual ccColor3B getColor(void);
|
||||
|
@ -96,7 +122,7 @@ namespace cocos2d{
|
|||
CCMenuItem* itemForTouch(CCTouch * touch);
|
||||
|
||||
protected:
|
||||
MenuState m_eState;
|
||||
tCCMenuState m_eState;
|
||||
CCMenuItem *m_pSelectedItem;
|
||||
GLubyte m_cOpacity;
|
||||
ccColor3B m_tColor;
|
||||
|
|
|
@ -102,7 +102,6 @@ namespace cocos2d{
|
|||
@warning setIsEnabled changes the RGB color of the font
|
||||
*/
|
||||
virtual void setIsEnabled(bool enabled);
|
||||
virtual void draw();
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual GLubyte getOpacity();
|
||||
virtual void setColor(ccColor3B color);
|
||||
|
@ -176,7 +175,6 @@ namespace cocos2d{
|
|||
,m_pSelectedImage(NULL)
|
||||
,m_pDisabledImage(NULL)
|
||||
{}
|
||||
virtual ~CCMenuItemSprite();
|
||||
/** creates a menu item with a normal and selected image*/
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite);
|
||||
/** creates a menu item with a normal and selected image with target/selector */
|
||||
|
@ -186,12 +184,18 @@ namespace cocos2d{
|
|||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector);
|
||||
// super methods
|
||||
virtual void draw();
|
||||
virtual void setColor(ccColor3B color){}
|
||||
virtual ccColor3B getColor(){return ccBLACK;}
|
||||
virtual void setOpacity(GLubyte opacity){}
|
||||
virtual GLubyte getOpacity(){return 0;}
|
||||
|
||||
/**
|
||||
@since v0.99.5
|
||||
*/
|
||||
virtual void selected();
|
||||
virtual void unselected();
|
||||
virtual void setIsEnabled(bool bEnabled);
|
||||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
};
|
||||
|
||||
|
|
|
@ -105,55 +105,55 @@ private:
|
|||
/** @brief A CCTransition that supports orientation like.
|
||||
* Possible orientation: LeftOver, RightOver, UpOver, DownOver
|
||||
*/
|
||||
class CCX_DLL CCOrientedTransitionScene : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionSceneOriented : public CCTransitionScene
|
||||
{
|
||||
protected:
|
||||
tOrientation m_eOrientation;
|
||||
|
||||
public:
|
||||
CCOrientedTransitionScene();
|
||||
virtual ~CCOrientedTransitionScene();
|
||||
CCTransitionSceneOriented();
|
||||
virtual ~CCTransitionSceneOriented();
|
||||
|
||||
/** creates a base transition with duration and incoming scene */
|
||||
static CCOrientedTransitionScene * transitionWithDuration(ccTime t,CCScene* scene, tOrientation orientation);
|
||||
static CCTransitionSceneOriented * transitionWithDuration(ccTime t,CCScene* scene, tOrientation orientation);
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
virtual bool initWithDuration(ccTime t,CCScene* scene,tOrientation orientation);
|
||||
};
|
||||
|
||||
/** @brief CCRotoZoomTransition:
|
||||
/** @brief CCTransitionRotoZoom:
|
||||
Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
|
||||
*/
|
||||
class CCX_DLL CCRotoZoomTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionRotoZoom : public CCTransitionScene
|
||||
{
|
||||
public:
|
||||
CCRotoZoomTransition();
|
||||
virtual ~CCRotoZoomTransition();
|
||||
CCTransitionRotoZoom();
|
||||
virtual ~CCTransitionRotoZoom();
|
||||
virtual void onEnter();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCRotoZoomTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionRotoZoom);
|
||||
};
|
||||
|
||||
/** @brief CCJumpZoomTransition:
|
||||
/** @brief CCTransitionJumpZoom:
|
||||
Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
|
||||
*/
|
||||
class CCX_DLL CCJumpZoomTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionJumpZoom : public CCTransitionScene
|
||||
{
|
||||
public:
|
||||
CCJumpZoomTransition();
|
||||
virtual ~CCJumpZoomTransition();
|
||||
CCTransitionJumpZoom();
|
||||
virtual ~CCTransitionJumpZoom();
|
||||
virtual void onEnter();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCJumpZoomTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionJumpZoom);
|
||||
};
|
||||
|
||||
/** @brief CCMoveInLTransition:
|
||||
/** @brief CCTransitionMoveInL:
|
||||
Move in from to the left the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCMoveInLTransition : public CCTransitionScene, public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionMoveInL : public CCTransitionScene, public CCTransitionEaseScene
|
||||
{
|
||||
public:
|
||||
CCMoveInLTransition();
|
||||
virtual ~CCMoveInLTransition();
|
||||
CCTransitionMoveInL();
|
||||
virtual ~CCTransitionMoveInL();
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed */
|
||||
|
@ -163,56 +163,56 @@ public:
|
|||
|
||||
virtual void onEnter();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCMoveInLTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInL);
|
||||
};
|
||||
|
||||
/** @brief CCMoveInRTransition:
|
||||
/** @brief CCTransitionMoveInR:
|
||||
Move in from to the right the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCMoveInRTransition : public CCMoveInLTransition
|
||||
class CCX_DLL CCTransitionMoveInR : public CCTransitionMoveInL
|
||||
{
|
||||
public:
|
||||
CCMoveInRTransition();
|
||||
virtual ~CCMoveInRTransition();
|
||||
CCTransitionMoveInR();
|
||||
virtual ~CCTransitionMoveInR();
|
||||
virtual void initScenes();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCMoveInRTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInR);
|
||||
};
|
||||
|
||||
/** @brief CCMoveInTTransition:
|
||||
/** @brief CCTransitionMoveInT:
|
||||
Move in from to the top the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCMoveInTTransition : public CCMoveInLTransition
|
||||
class CCX_DLL CCTransitionMoveInT : public CCTransitionMoveInL
|
||||
{
|
||||
public:
|
||||
CCMoveInTTransition();
|
||||
virtual ~CCMoveInTTransition();
|
||||
CCTransitionMoveInT();
|
||||
virtual ~CCTransitionMoveInT();
|
||||
virtual void initScenes();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCMoveInTTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInT);
|
||||
};
|
||||
|
||||
/** @brief CCMoveInBTransition:
|
||||
/** @brief CCTransitionMoveInB:
|
||||
Move in from to the bottom the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCMoveInBTransition : public CCMoveInLTransition
|
||||
class CCX_DLL CCTransitionMoveInB : public CCTransitionMoveInL
|
||||
{
|
||||
public:
|
||||
CCMoveInBTransition();
|
||||
virtual ~CCMoveInBTransition();
|
||||
CCTransitionMoveInB();
|
||||
virtual ~CCTransitionMoveInB();
|
||||
virtual void initScenes();
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCMoveInBTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInB);
|
||||
};
|
||||
|
||||
/** @brief CCSlideInLTransition:
|
||||
/** @brief CCTransitionSlideInL:
|
||||
Slide in the incoming scene from the left border.
|
||||
*/
|
||||
class CCX_DLL CCSlideInLTransition : public CCTransitionScene, public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionSlideInL : public CCTransitionScene, public CCTransitionEaseScene
|
||||
{
|
||||
public:
|
||||
CCSlideInLTransition();
|
||||
virtual ~CCSlideInLTransition();
|
||||
CCTransitionSlideInL();
|
||||
virtual ~CCTransitionSlideInL();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
@ -223,64 +223,64 @@ public:
|
|||
|
||||
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSlideInLTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInL);
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
};
|
||||
|
||||
/** @brief CCSlideInRTransition:
|
||||
/** @brief CCTransitionSlideInR:
|
||||
Slide in the incoming scene from the right border.
|
||||
*/
|
||||
class CCX_DLL CCSlideInRTransition : public CCSlideInLTransition
|
||||
class CCX_DLL CCTransitionSlideInR : public CCTransitionSlideInL
|
||||
{
|
||||
public:
|
||||
CCSlideInRTransition();
|
||||
virtual ~CCSlideInRTransition();
|
||||
CCTransitionSlideInR();
|
||||
virtual ~CCTransitionSlideInR();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
||||
virtual CCActionInterval* action(void);
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSlideInRTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInR);
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
};
|
||||
|
||||
/** @brief CCSlideInBTransition:
|
||||
/** @brief CCTransitionSlideInB:
|
||||
Slide in the incoming scene from the bottom border.
|
||||
*/
|
||||
class CCX_DLL CCSlideInBTransition : public CCSlideInLTransition
|
||||
class CCX_DLL CCTransitionSlideInB : public CCTransitionSlideInL
|
||||
{
|
||||
public:
|
||||
CCSlideInBTransition();
|
||||
virtual ~CCSlideInBTransition();
|
||||
CCTransitionSlideInB();
|
||||
virtual ~CCTransitionSlideInB();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
||||
virtual CCActionInterval* action(void);
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSlideInBTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInB);
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
};
|
||||
|
||||
/** @brief CCSlideInTTransition:
|
||||
/** @brief CCTransitionSlideInT:
|
||||
Slide in the incoming scene from the top border.
|
||||
*/
|
||||
class CCX_DLL CCSlideInTTransition : public CCSlideInLTransition
|
||||
class CCX_DLL CCTransitionSlideInT : public CCTransitionSlideInL
|
||||
{
|
||||
public:
|
||||
CCSlideInTTransition();
|
||||
virtual ~CCSlideInTTransition();
|
||||
CCTransitionSlideInT();
|
||||
virtual ~CCTransitionSlideInT();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
||||
virtual CCActionInterval* action(void);
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSlideInTTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInT);
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
};
|
||||
|
@ -288,125 +288,125 @@ protected:
|
|||
/**
|
||||
@brief Shrink the outgoing scene while grow the incoming scene
|
||||
*/
|
||||
class CCX_DLL CCShrinkGrowTransition : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionShrinkGrow : public CCTransitionScene , public CCTransitionEaseScene
|
||||
{
|
||||
public:
|
||||
CCShrinkGrowTransition();
|
||||
virtual ~CCShrinkGrowTransition();
|
||||
CCTransitionShrinkGrow();
|
||||
virtual ~CCTransitionShrinkGrow();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCShrinkGrowTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionShrinkGrow);
|
||||
};
|
||||
|
||||
/** @brief CCFlipXTransition:
|
||||
/** @brief CCTransitionFlipX:
|
||||
Flips the screen horizontally.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCFlipXTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionFlipX : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCFlipXTransition();
|
||||
virtual ~CCFlipXTransition();
|
||||
CCTransitionFlipX();
|
||||
virtual ~CCTransitionFlipX();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCFlipXTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCFlipYTransition:
|
||||
/** @brief CCTransitionFlipY:
|
||||
Flips the screen vertically.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCFlipYTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionFlipY : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCFlipYTransition();
|
||||
virtual ~CCFlipYTransition();
|
||||
CCTransitionFlipY();
|
||||
virtual ~CCTransitionFlipY();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCFlipYTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
};
|
||||
|
||||
/** @brief CCFlipAngularTransition:
|
||||
/** @brief CCTransitionFlipAngular:
|
||||
Flips the screen half horizontally and half vertically.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCFlipAngularTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionFlipAngular : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCFlipAngularTransition();
|
||||
virtual ~CCFlipAngularTransition();
|
||||
CCTransitionFlipAngular();
|
||||
virtual ~CCTransitionFlipAngular();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCFlipAngularTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCZoomFlipXTransition:
|
||||
/** @brief CCTransitionZoomFlipX:
|
||||
Flips the screen horizontally doing a zoom out/in
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCX_DLL CCZoomFlipXTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionZoomFlipX : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCZoomFlipXTransition();
|
||||
virtual ~CCZoomFlipXTransition();
|
||||
CCTransitionZoomFlipX();
|
||||
virtual ~CCTransitionZoomFlipX();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCZoomFlipXTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCZoomFlipYTransition:
|
||||
/** @brief CCTransitionZoomFlipY:
|
||||
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.
|
||||
*/
|
||||
class CCX_DLL CCZoomFlipYTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionZoomFlipY : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCZoomFlipYTransition();
|
||||
virtual ~CCZoomFlipYTransition();
|
||||
CCTransitionZoomFlipY();
|
||||
virtual ~CCTransitionZoomFlipY();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCZoomFlipYTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
};
|
||||
|
||||
/** @brief CCZoomFlipAngularTransition:
|
||||
/** @brief CCTransitionZoomFlipAngular:
|
||||
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.
|
||||
*/
|
||||
class CCX_DLL CCZoomFlipAngularTransition : public CCOrientedTransitionScene
|
||||
class CCX_DLL CCTransitionZoomFlipAngular : public CCTransitionSceneOriented
|
||||
{
|
||||
public:
|
||||
CCZoomFlipAngularTransition();
|
||||
virtual ~CCZoomFlipAngularTransition();
|
||||
CCTransitionZoomFlipAngular();
|
||||
virtual ~CCTransitionZoomFlipAngular();
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
static CCZoomFlipAngularTransition* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCFadeTransition:
|
||||
/** @brief CCTransitionFade:
|
||||
Fade out the outgoing scene and then fade in the incoming scene.'''
|
||||
*/
|
||||
class CCX_DLL CCFadeTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionFade : public CCTransitionScene
|
||||
{
|
||||
protected:
|
||||
ccColor4B m_tColor;
|
||||
|
||||
public:
|
||||
|
||||
CCFadeTransition();
|
||||
virtual ~CCFadeTransition();
|
||||
CCTransitionFade();
|
||||
virtual ~CCTransitionFade();
|
||||
|
||||
/** creates the transition with a duration and with an RGB color
|
||||
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
|
||||
*/
|
||||
static CCFadeTransition* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
|
||||
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
|
||||
/** initializes the transition with a duration and with an RGB color */
|
||||
virtual bool initWithDuration(ccTime t, CCScene*scene ,ccColor3B color);
|
||||
|
||||
|
@ -417,132 +417,132 @@ public:
|
|||
|
||||
class CCRenderTexture;
|
||||
/**
|
||||
@brief CCCrossFadeTransition:
|
||||
@brief CCTransitionCrossFade:
|
||||
Cross fades two scenes using the CCRenderTexture object.
|
||||
*/
|
||||
class CCX_DLL CCCrossFadeTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionCrossFade : public CCTransitionScene
|
||||
{
|
||||
public :
|
||||
CCCrossFadeTransition();
|
||||
virtual ~CCCrossFadeTransition();
|
||||
CCTransitionCrossFade();
|
||||
virtual ~CCTransitionCrossFade();
|
||||
|
||||
virtual void draw();
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCCrossFadeTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionCrossFade);
|
||||
};
|
||||
|
||||
/** @brief CCTurnOffTilesTransition:
|
||||
/** @brief CCTransitionTurnOffTiles:
|
||||
Turn off the tiles of the outgoing scene in random order
|
||||
*/
|
||||
class CCX_DLL CCTurnOffTilesTransition : public CCTransitionScene ,public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionTurnOffTiles : public CCTransitionScene ,public CCTransitionEaseScene
|
||||
{
|
||||
public :
|
||||
CCTurnOffTilesTransition();
|
||||
virtual ~CCTurnOffTilesTransition();
|
||||
CCTransitionTurnOffTiles();
|
||||
virtual ~CCTransitionTurnOffTiles();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTurnOffTilesTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionTurnOffTiles);
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
};
|
||||
|
||||
/** @brief CCSplitColsTransition:
|
||||
/** @brief CCTransitionSplitCols:
|
||||
The odd columns goes upwards while the even columns goes downwards.
|
||||
*/
|
||||
class CCX_DLL CCSplitColsTransition : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionSplitCols : public CCTransitionScene , public CCTransitionEaseScene
|
||||
{
|
||||
public:
|
||||
CCSplitColsTransition();
|
||||
virtual ~CCSplitColsTransition();
|
||||
CCTransitionSplitCols();
|
||||
virtual ~CCTransitionSplitCols();
|
||||
|
||||
virtual CCActionInterval* action(void);
|
||||
virtual void onEnter();
|
||||
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSplitColsTransition);
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitCols);
|
||||
};
|
||||
|
||||
/** @brief CCSplitRowsTransition:
|
||||
/** @brief CCTransitionSplitRows:
|
||||
The odd rows goes to the left while the even rows goes to the right.
|
||||
*/
|
||||
class CCX_DLL CCSplitRowsTransition : public CCSplitColsTransition
|
||||
class CCX_DLL CCTransitionSplitRows : public CCTransitionSplitCols
|
||||
{
|
||||
public:
|
||||
CCSplitRowsTransition();
|
||||
virtual ~CCSplitRowsTransition();
|
||||
CCTransitionSplitRows();
|
||||
virtual ~CCTransitionSplitRows();
|
||||
|
||||
virtual CCActionInterval* action(void);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCSplitRowsTransition)
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitRows)
|
||||
};
|
||||
|
||||
/** @brief CCFadeTRTransition:
|
||||
/** @brief CCTransitionFadeTR:
|
||||
Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
|
||||
*/
|
||||
class CCX_DLL CCFadeTRTransition : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCX_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransitionEaseScene
|
||||
{
|
||||
public:
|
||||
CCFadeTRTransition();
|
||||
virtual ~CCFadeTRTransition();
|
||||
CCTransitionFadeTR();
|
||||
virtual ~CCTransitionFadeTR();
|
||||
virtual CCActionInterval* actionWithSize(ccGridSize size);
|
||||
virtual void onEnter();
|
||||
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCFadeTRTransition)
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeTR)
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
|
||||
};
|
||||
|
||||
/** @brief CCFadeBLTransition:
|
||||
/** @brief CCTransitionFadeBL:
|
||||
Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
|
||||
*/
|
||||
class CCX_DLL CCFadeBLTransition : public CCFadeTRTransition
|
||||
class CCX_DLL CCTransitionFadeBL : public CCTransitionFadeTR
|
||||
{
|
||||
public:
|
||||
CCFadeBLTransition();
|
||||
virtual ~CCFadeBLTransition();
|
||||
CCTransitionFadeBL();
|
||||
virtual ~CCTransitionFadeBL();
|
||||
virtual CCActionInterval* actionWithSize(ccGridSize size);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCFadeBLTransition)
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL)
|
||||
};
|
||||
|
||||
/** @brief CCFadeUpTransition:
|
||||
/** @brief CCTransitionFadeUp:
|
||||
* Fade the tiles of the outgoing scene from the bottom to the top.
|
||||
*/
|
||||
class CCX_DLL CCFadeUpTransition : public CCFadeTRTransition
|
||||
class CCX_DLL CCTransitionFadeUp : public CCTransitionFadeTR
|
||||
{
|
||||
public:
|
||||
CCFadeUpTransition();
|
||||
virtual ~CCFadeUpTransition();
|
||||
CCTransitionFadeUp();
|
||||
virtual ~CCTransitionFadeUp();
|
||||
virtual CCActionInterval* actionWithSize(ccGridSize size);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCFadeUpTransition)
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp)
|
||||
};
|
||||
|
||||
/** @brief CCFadeDownTransition:
|
||||
/** @brief CCTransitionFadeDown:
|
||||
* Fade the tiles of the outgoing scene from the top to the bottom.
|
||||
*/
|
||||
class CCX_DLL CCFadeDownTransition : public CCFadeTRTransition
|
||||
class CCX_DLL CCTransitionFadeDown : public CCTransitionFadeTR
|
||||
{
|
||||
public:
|
||||
CCFadeDownTransition();
|
||||
virtual ~CCFadeDownTransition();
|
||||
CCTransitionFadeDown();
|
||||
virtual ~CCTransitionFadeDown();
|
||||
virtual CCActionInterval* actionWithSize(ccGridSize size);
|
||||
|
||||
public:
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCFadeDownTransition)
|
||||
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown)
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
||||
|
|
|
@ -39,21 +39,21 @@ is turned on in CCDirector using:
|
|||
|
||||
@since v0.8.2
|
||||
*/
|
||||
class CCX_DLL CCPageTurnTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionPageTurn : public CCTransitionScene
|
||||
{
|
||||
protected:
|
||||
bool m_bBack;
|
||||
|
||||
public:
|
||||
CCPageTurnTransition();
|
||||
virtual ~CCPageTurnTransition();
|
||||
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 CCPageTurnTransition* transitionWithDuration(ccTime t,CCScene* scene,bool backwards);
|
||||
static CCTransitionPageTurn* transitionWithDuration(ccTime t,CCScene* scene,bool backwards);
|
||||
|
||||
/**
|
||||
* Creates a base transition with duration and incoming scene.
|
|
@ -32,16 +32,16 @@ namespace cocos2d {
|
|||
/**
|
||||
@brief A counter colock-wise radial transition to the next scene
|
||||
*/
|
||||
class CCX_DLL CCRadialCCWTransition : public CCTransitionScene
|
||||
class CCX_DLL CCTransitionRadialCCW : public CCTransitionScene
|
||||
{
|
||||
public:
|
||||
CCRadialCCWTransition(){}
|
||||
virtual ~CCRadialCCWTransition(){}
|
||||
CCTransitionRadialCCW(){}
|
||||
virtual ~CCTransitionRadialCCW(){}
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
|
||||
static CCRadialCCWTransition* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
static CCTransitionRadialCCW* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
|
@ -51,12 +51,12 @@ protected:
|
|||
/**
|
||||
@brief A counter colock-wise radial transition to the next scene
|
||||
*/
|
||||
class CCX_DLL CCRadialCWTransition : public CCRadialCCWTransition
|
||||
class CCX_DLL CCTransitionRadialCW : public CCTransitionRadialCCW
|
||||
{
|
||||
public:
|
||||
CCRadialCWTransition(){}
|
||||
virtual ~CCRadialCWTransition(){}
|
||||
static CCRadialCWTransition* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
CCTransitionRadialCW(){}
|
||||
virtual ~CCTransitionRadialCW(){}
|
||||
static CCTransitionRadialCW* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
protected:
|
||||
virtual CCProgressTimerType radialType();
|
|
@ -72,10 +72,10 @@ THE SOFTWARE.
|
|||
#include "CCRenderTexture.h"
|
||||
#include "CCMotionStreak.h"
|
||||
#include "CCActionPageTurn3D.h"
|
||||
#include "CCPageTurnTransition.h"
|
||||
#include "CCTransitionPageTurn.h"
|
||||
#include "CCTexture2D.h"
|
||||
#include "CCPVRTexture.h"
|
||||
#include "CCRadialTransition.h"
|
||||
#include "CCTransitionRadial.h"
|
||||
#include "CCActionProgressTimer.h"
|
||||
#include "CCTouchDispatcher.h"
|
||||
#include "CCDrawingPrimitives.h"
|
||||
|
|
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCPageTurnTransition.h"
|
||||
#include "CCTransitionPageTurn.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCActionInterval.h"
|
||||
#include "CCActionInstant.h"
|
||||
|
@ -31,24 +31,24 @@ THE SOFTWARE.
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
CCPageTurnTransition::CCPageTurnTransition()
|
||||
CCTransitionPageTurn::CCTransitionPageTurn()
|
||||
{
|
||||
}
|
||||
CCPageTurnTransition::~CCPageTurnTransition()
|
||||
CCTransitionPageTurn::~CCTransitionPageTurn()
|
||||
{
|
||||
}
|
||||
|
||||
/** creates a base transition with duration and incoming scene */
|
||||
CCPageTurnTransition * CCPageTurnTransition::transitionWithDuration(ccTime t, CCScene *scene, bool backwards)
|
||||
CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(ccTime t, CCScene *scene, bool backwards)
|
||||
{
|
||||
CCPageTurnTransition * pTransition = new CCPageTurnTransition();
|
||||
CCTransitionPageTurn * pTransition = new CCTransitionPageTurn();
|
||||
pTransition->initWithDuration(t,scene,backwards);
|
||||
pTransition->autorelease();
|
||||
return pTransition;
|
||||
}
|
||||
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
bool CCPageTurnTransition::initWithDuration(ccTime t, CCScene *scene, bool backwards)
|
||||
bool CCTransitionPageTurn::initWithDuration(ccTime t, CCScene *scene, bool backwards)
|
||||
{
|
||||
// XXX: needed before [super init]
|
||||
m_bBack = backwards;
|
||||
|
@ -60,23 +60,25 @@ bool CCPageTurnTransition::initWithDuration(ccTime t, CCScene *scene, bool backw
|
|||
return true;
|
||||
}
|
||||
|
||||
void CCPageTurnTransition::sceneOrder()
|
||||
void CCTransitionPageTurn::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = m_bBack;
|
||||
}
|
||||
|
||||
void CCPageTurnTransition::onEnter()
|
||||
void CCTransitionPageTurn::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
int x,y;
|
||||
if( s.width > s.height)
|
||||
{
|
||||
x=16;y=12;
|
||||
x=16;
|
||||
y=12;
|
||||
}
|
||||
else
|
||||
{
|
||||
x=12;y=16;
|
||||
x=12;
|
||||
y=16;
|
||||
}
|
||||
|
||||
CCActionInterval *action = this->actionWithSize(ccg(x,y));
|
||||
|
@ -113,7 +115,7 @@ void CCPageTurnTransition::onEnter()
|
|||
}
|
||||
|
||||
|
||||
CCActionInterval* CCPageTurnTransition:: actionWithSize(ccGridSize vector)
|
||||
CCActionInterval* CCTransitionPageTurn:: actionWithSize(ccGridSize vector)
|
||||
{
|
||||
if( m_bBack )
|
||||
{
|
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCRadialTransition.h"
|
||||
#include "CCTransitionRadial.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCRenderTexture.h"
|
||||
#include "CCActionInstant.h"
|
||||
|
@ -42,17 +42,17 @@ enum {
|
|||
kSceneRadial = 0xc001,
|
||||
};
|
||||
|
||||
void CCRadialCCWTransition::sceneOrder()
|
||||
void CCTransitionRadialCCW::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = false;
|
||||
}
|
||||
|
||||
CCProgressTimerType CCRadialCCWTransition::radialType()
|
||||
CCProgressTimerType CCTransitionRadialCCW::radialType()
|
||||
{
|
||||
return kCCProgressTimerTypeRadialCCW;
|
||||
}
|
||||
|
||||
void CCRadialCCWTransition::onEnter()
|
||||
void CCTransitionRadialCCW::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
// create a transparent color layer
|
||||
|
@ -100,30 +100,30 @@ void CCRadialCCWTransition::onEnter()
|
|||
|
||||
|
||||
// clean up on exit
|
||||
void CCRadialCCWTransition::onExit()
|
||||
void CCTransitionRadialCCW::onExit()
|
||||
{
|
||||
// remove our layer and release all containing objects
|
||||
this->removeChildByTag(kSceneRadial, false);
|
||||
CCTransitionScene::onExit();
|
||||
}
|
||||
|
||||
CCRadialCCWTransition* CCRadialCCWTransition::transitionWithDuration(ccTime t, CCScene* scene)
|
||||
CCTransitionRadialCCW* CCTransitionRadialCCW::transitionWithDuration(ccTime t, CCScene* scene)
|
||||
{
|
||||
CCRadialCCWTransition* pScene = new CCRadialCCWTransition();
|
||||
CCTransitionRadialCCW* pScene = new CCTransitionRadialCCW();
|
||||
pScene->initWithDuration(t, scene);
|
||||
pScene->autorelease();
|
||||
|
||||
return pScene;
|
||||
}
|
||||
|
||||
CCProgressTimerType CCRadialCWTransition::radialType()
|
||||
CCProgressTimerType CCTransitionRadialCW::radialType()
|
||||
{
|
||||
return kCCProgressTimerTypeRadialCW;
|
||||
}
|
||||
|
||||
CCRadialCWTransition* CCRadialCWTransition::transitionWithDuration(ccTime t, CCScene* scene)
|
||||
CCTransitionRadialCW* CCTransitionRadialCW::transitionWithDuration(ccTime t, CCScene* scene)
|
||||
{
|
||||
CCRadialCWTransition* pScene = new CCRadialCWTransition();
|
||||
CCTransitionRadialCW* pScene = new CCTransitionRadialCW();
|
||||
pScene->initWithDuration(t, scene);
|
||||
pScene->autorelease();
|
||||
|
|
@ -113,10 +113,19 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemLabel::setLabel(CCNode* var)
|
||||
{
|
||||
CCX_SAFE_RETAIN(var);
|
||||
CCX_SAFE_RELEASE(m_pLabel);
|
||||
if (var)
|
||||
{
|
||||
addChild(var);
|
||||
var->setAnchorPoint(ccp(0, 0));
|
||||
setContentSize(var->getContentSize());
|
||||
}
|
||||
|
||||
if (m_pLabel)
|
||||
{
|
||||
removeChild(m_pLabel, YES);
|
||||
}
|
||||
|
||||
m_pLabel = var;
|
||||
this->setContentSize(m_pLabel->getContentSize());
|
||||
}
|
||||
CCMenuItemLabel * CCMenuItemLabel::itemWithLabel(CCNode*label, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
|
@ -195,10 +204,6 @@ namespace cocos2d{
|
|||
}
|
||||
CCMenuItem::setIsEnabled(enabled);
|
||||
}
|
||||
void CCMenuItemLabel::draw()
|
||||
{
|
||||
m_pLabel->draw();
|
||||
}
|
||||
void CCMenuItemLabel::setOpacity(GLubyte opacity)
|
||||
{
|
||||
m_pLabel->convertToRGBAProtocol()->setOpacity(opacity);
|
||||
|
@ -233,7 +238,7 @@ namespace cocos2d{
|
|||
}
|
||||
bool CCMenuItemAtlasFont::initFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
NSAssert( value != NULL && strlen(value) != 0, "value lenght must be greater than 0");
|
||||
NSAssert( value != NULL && strlen(value) != 0, "value length must be greater than 0");
|
||||
CCLabelAtlas *label = new CCLabelAtlas();
|
||||
label->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap);
|
||||
label->autorelease();
|
||||
|
@ -283,7 +288,7 @@ namespace cocos2d{
|
|||
}
|
||||
bool CCMenuItemFont::initFromString(const char *value, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
NSAssert( value != NULL && strlen(value) != 0, "Value lenght must be greater than 0");
|
||||
NSAssert( value != NULL && strlen(value) != 0, "Value length must be greater than 0");
|
||||
CCLabelTTF *label = CCLabelTTF::labelWithString(value, _fontName.c_str(), (float)_fontSize);
|
||||
if (CCMenuItemLabel::initWithLabel(label, target, selector))
|
||||
{
|
||||
|
@ -300,9 +305,19 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemSprite::setNormalImage(CCNode* var)
|
||||
{
|
||||
CCX_SAFE_RETAIN(var);
|
||||
CCX_SAFE_RELEASE(m_pNormalImage);
|
||||
m_pNormalImage = var;
|
||||
if (var)
|
||||
{
|
||||
addChild(var);
|
||||
var->setAnchorPoint(ccp(0, 0));
|
||||
var->setIsVisible(YES);
|
||||
}
|
||||
|
||||
if (m_pNormalImage)
|
||||
{
|
||||
removeChild(m_pNormalImage, YES);
|
||||
}
|
||||
|
||||
m_pNormalImage = var;
|
||||
}
|
||||
CCNode * CCMenuItemSprite::getSelectedImage()
|
||||
{
|
||||
|
@ -310,9 +325,19 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemSprite::setSelectedImage(CCNode* var)
|
||||
{
|
||||
CCX_SAFE_RETAIN(var);
|
||||
CCX_SAFE_RELEASE(m_pSelectedImage);
|
||||
m_pSelectedImage = var;
|
||||
if (var)
|
||||
{
|
||||
addChild(var);
|
||||
var->setAnchorPoint(ccp(0, 0));
|
||||
var->setIsVisible(NO);
|
||||
}
|
||||
|
||||
if (m_pSelectedImage)
|
||||
{
|
||||
removeChild(m_pSelectedImage, YES);
|
||||
}
|
||||
|
||||
m_pSelectedImage = var;
|
||||
}
|
||||
CCNode * CCMenuItemSprite::getDisabledImage()
|
||||
{
|
||||
|
@ -320,9 +345,19 @@ namespace cocos2d{
|
|||
}
|
||||
void CCMenuItemSprite::setDisabledImage(CCNode* var)
|
||||
{
|
||||
CCX_SAFE_RETAIN(var);
|
||||
CCX_SAFE_RELEASE(m_pDisabledImage);
|
||||
m_pDisabledImage = var;
|
||||
if (var)
|
||||
{
|
||||
addChild(var);
|
||||
var->setAnchorPoint(ccp(0, 0));
|
||||
var->setIsVisible(NO);
|
||||
}
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
removeChild(m_pDisabledImage, YES);
|
||||
}
|
||||
|
||||
m_pDisabledImage = var;
|
||||
}
|
||||
CCMenuItemSprite * CCMenuItemSprite::itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite)
|
||||
{
|
||||
|
@ -349,38 +384,79 @@ namespace cocos2d{
|
|||
this->setContentSize(m_pNormalImage->getContentSize());
|
||||
return true;
|
||||
}
|
||||
CCMenuItemSprite::~CCMenuItemSprite()
|
||||
{
|
||||
CCX_SAFE_RELEASE(m_pNormalImage);
|
||||
CCX_SAFE_RELEASE(m_pSelectedImage);
|
||||
CCX_SAFE_RELEASE(m_pDisabledImage);
|
||||
}
|
||||
void CCMenuItemSprite::draw()
|
||||
{
|
||||
if(m_bIsEnabled)
|
||||
{
|
||||
if( m_bIsSelected )
|
||||
{
|
||||
m_pSelectedImage->draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pNormalImage->draw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_pDisabledImage != NULL)
|
||||
{
|
||||
m_pDisabledImage->draw();
|
||||
}
|
||||
// disabled image was not provided
|
||||
else
|
||||
{
|
||||
m_pNormalImage->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@since v0.99.5
|
||||
*/
|
||||
void CCMenuItemSprite::selected()
|
||||
{
|
||||
CCMenuItem::selected();
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
m_pDisabledImage->setIsVisible(NO);
|
||||
}
|
||||
|
||||
if (m_pSelectedImage)
|
||||
{
|
||||
m_pNormalImage->setIsVisible(NO);
|
||||
m_pSelectedImage->setIsVisible(YES);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pNormalImage->setIsVisible(YES);
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenuItemSprite::unselected()
|
||||
{
|
||||
CCMenuItem::unselected();
|
||||
|
||||
m_pNormalImage->setIsVisible(YES);
|
||||
|
||||
if (m_pSelectedImage)
|
||||
{
|
||||
m_pSelectedImage->setIsVisible(NO);
|
||||
}
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
m_pDisabledImage->setIsVisible(NO);
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenuItemSprite::setIsEnabled(bool bEnabled)
|
||||
{
|
||||
CCMenuItem::setIsEnabled(bEnabled);
|
||||
|
||||
if (m_pSelectedImage)
|
||||
{
|
||||
m_pSelectedImage->setIsVisible(NO);
|
||||
}
|
||||
|
||||
if (bEnabled)
|
||||
{
|
||||
m_pNormalImage->setIsVisible(YES);
|
||||
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
m_pDisabledImage->setIsVisible(NO);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_pDisabledImage)
|
||||
{
|
||||
m_pDisabledImage->setIsVisible(YES);
|
||||
m_pNormalImage->setIsVisible(NO);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pNormalImage->setIsVisible(YES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//CCMenuItemImage - CCRGBAProtocol protocol
|
||||
//
|
||||
|
@ -445,9 +521,14 @@ namespace cocos2d{
|
|||
bool CCMenuItemImage::initFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
CCNode *normalSprite = CCSprite::spriteWithFile(normalImage);
|
||||
CCNode *selectedSprite = CCSprite::spriteWithFile(selectedImage);
|
||||
CCNode *selectedSprite = NULL;
|
||||
CCNode *disabledSprite = NULL;
|
||||
|
||||
if (selectedImage)
|
||||
{
|
||||
selectedSprite = CCSprite::spriteWithFile(selectedImage);
|
||||
}
|
||||
|
||||
if(disabledImage)
|
||||
{
|
||||
disabledSprite = CCSprite::spriteWithFile(disabledImage);
|
||||
|
|
|
@ -35,6 +35,8 @@ CCLayer::CCLayer()
|
|||
:m_bIsTouchEnabled(false)
|
||||
,m_bIsAccelerometerEnabled(false)
|
||||
,m_bIsKeypadEnabled(false)
|
||||
,m_bIsMouseEnabled(false)
|
||||
,m_bIsKeyboardEnabled(false)
|
||||
{
|
||||
m_eTouchDelegateType = ccTouchDeletateAllBit;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
|
@ -111,6 +113,25 @@ void CCLayer::KeypadKeep()
|
|||
this->retain();
|
||||
}
|
||||
|
||||
bool CCLayer::getIsMouseEnabled()
|
||||
{
|
||||
return m_bIsMouseEnabled;
|
||||
}
|
||||
|
||||
void CCLayer::setIsMouseEnabled(bool enabled)
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupportted!");
|
||||
}
|
||||
|
||||
bool CCLayer::getIsKeyboardEnabled()
|
||||
{
|
||||
return m_bIsKeyboardEnabled;
|
||||
}
|
||||
|
||||
void CCLayer::setIsKeyboardEnabled(bool enabled)
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupportted!");
|
||||
}
|
||||
|
||||
/// isTouchEnabled getter
|
||||
bool CCLayer::getIsTouchEnabled()
|
||||
|
@ -239,6 +260,16 @@ void CCLayer::onExit()
|
|||
CCNode::onExit();
|
||||
}
|
||||
|
||||
void CCLayer::onEnterTransitionDidFinish()
|
||||
{
|
||||
if (m_bIsAccelerometerEnabled)
|
||||
{
|
||||
UIAccelerometer::sharedAccelerometer()->addDelegate(this);
|
||||
}
|
||||
|
||||
CCNode::onEnterTransitionDidFinish();
|
||||
}
|
||||
|
||||
bool CCLayer::ccTouchBegan(CCTouch *pTouch, UIEvent *pEvent)
|
||||
{
|
||||
NSAssert(false, "Layer#ccTouchBegan override me");
|
||||
|
@ -248,34 +279,34 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, UIEvent *pEvent)
|
|||
/// ColorLayer
|
||||
|
||||
|
||||
CCColorLayer::CCColorLayer()
|
||||
CCLayerColor::CCLayerColor()
|
||||
{
|
||||
}
|
||||
CCColorLayer::~CCColorLayer()
|
||||
CCLayerColor::~CCLayerColor()
|
||||
{
|
||||
}
|
||||
|
||||
// Opacity and RGB color protocol
|
||||
/// opacity getter
|
||||
GLubyte CCColorLayer::getOpacity()
|
||||
GLubyte CCLayerColor::getOpacity()
|
||||
{
|
||||
return m_cOpacity;
|
||||
}
|
||||
/// opacity setter
|
||||
void CCColorLayer::setOpacity(GLubyte var)
|
||||
void CCLayerColor::setOpacity(GLubyte var)
|
||||
{
|
||||
m_cOpacity = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
/// color getter
|
||||
ccColor3B CCColorLayer::getColor()
|
||||
ccColor3B CCLayerColor::getColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
/// color setter
|
||||
void CCColorLayer::setColor(ccColor3B var)
|
||||
void CCLayerColor::setColor(ccColor3B var)
|
||||
{
|
||||
m_tColor = var;
|
||||
updateColor();
|
||||
|
@ -283,20 +314,20 @@ void CCColorLayer::setColor(ccColor3B var)
|
|||
|
||||
|
||||
/// blendFunc getter
|
||||
ccBlendFunc CCColorLayer::getBlendFunc()
|
||||
ccBlendFunc CCLayerColor::getBlendFunc()
|
||||
{
|
||||
return m_tBlendFunc;
|
||||
}
|
||||
/// blendFunc setter
|
||||
void CCColorLayer::setBlendFunc(ccBlendFunc var)
|
||||
void CCLayerColor::setBlendFunc(ccBlendFunc var)
|
||||
{
|
||||
m_tBlendFunc = var;
|
||||
}
|
||||
|
||||
|
||||
CCColorLayer * CCColorLayer::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
{
|
||||
CCColorLayer * pLayer = new CCColorLayer();
|
||||
CCLayerColor * pLayer = new CCLayerColor();
|
||||
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
|
@ -305,9 +336,9 @@ CCColorLayer * CCColorLayer::layerWithColorWidthHeight(ccColor4B color, GLfloat
|
|||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
CCColorLayer * CCColorLayer::layerWithColor(ccColor4B color)
|
||||
CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color)
|
||||
{
|
||||
CCColorLayer * pLayer = new CCColorLayer();
|
||||
CCLayerColor * pLayer = new CCLayerColor();
|
||||
if(pLayer && pLayer->initWithColor(color))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
|
@ -317,7 +348,7 @@ CCColorLayer * CCColorLayer::layerWithColor(ccColor4B color)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool CCColorLayer::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
{
|
||||
// default blend function
|
||||
m_tBlendFunc.src = CC_BLEND_SRC;
|
||||
|
@ -338,7 +369,7 @@ bool CCColorLayer::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfl
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CCColorLayer::initWithColor(ccColor4B color)
|
||||
bool CCLayerColor::initWithColor(ccColor4B color)
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
this->initWithColorWidthHeight(color, s.width, s.height);
|
||||
|
@ -346,47 +377,43 @@ bool CCColorLayer::initWithColor(ccColor4B color)
|
|||
}
|
||||
|
||||
/// override contentSize
|
||||
void CCColorLayer::setContentSize(CGSize size)
|
||||
void CCLayerColor::setContentSize(CGSize size)
|
||||
{
|
||||
m_pSquareVertices[2] = size.width;
|
||||
m_pSquareVertices[5] = size.height;
|
||||
m_pSquareVertices[6] = size.width;
|
||||
m_pSquareVertices[7] = size.height;
|
||||
m_pSquareVertices[2] = size.width * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[5] = size.height * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[6] = size.width * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[7] = size.height * CC_CONTENT_SCALE_FACTOR();
|
||||
|
||||
CCLayer::setContentSize(size);
|
||||
}
|
||||
|
||||
void CCColorLayer::changeWidthAndHeight(GLfloat w ,GLfloat h)
|
||||
void CCLayerColor::changeWidthAndHeight(GLfloat w ,GLfloat h)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(w, h));
|
||||
}
|
||||
|
||||
void CCColorLayer::changeWidth(GLfloat w)
|
||||
void CCLayerColor::changeWidth(GLfloat w)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(w, m_tContentSize.height));
|
||||
}
|
||||
|
||||
void CCColorLayer::changeHeight(GLfloat h)
|
||||
void CCLayerColor::changeHeight(GLfloat h)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(m_tContentSize.width, h));
|
||||
}
|
||||
|
||||
void CCColorLayer::updateColor()
|
||||
void CCLayerColor::updateColor()
|
||||
{
|
||||
for( unsigned int i=0; i < sizeof(m_pSquareColors) / sizeof(m_pSquareColors[0]); i++ )
|
||||
for( unsigned int i=0; i < 4; i++ )
|
||||
{
|
||||
if( i % 4 == 0 )
|
||||
m_pSquareColors[i] = m_tColor.r;
|
||||
else if( i % 4 == 1)
|
||||
m_pSquareColors[i] = m_tColor.g;
|
||||
else if( i % 4 ==2 )
|
||||
m_pSquareColors[i] = m_tColor.b;
|
||||
else
|
||||
m_pSquareColors[i] = m_cOpacity;
|
||||
m_pSquareColors[i * 4] = m_tColor.r;
|
||||
m_pSquareColors[i * 4 + 1] = m_tColor.g;
|
||||
m_pSquareColors[i * 4 + 2] = m_tColor.b;
|
||||
m_pSquareColors[i * 4 + 3] = m_cOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
void CCColorLayer::draw()
|
||||
void CCLayerColor::draw()
|
||||
{
|
||||
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
|
||||
// Needed states: GL_VERTEX_ARRAY, GL_COLOR_ARRAY
|
||||
|
@ -417,6 +444,154 @@ void CCColorLayer::draw()
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CGPoint v)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end, v))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
return initWithColor(start, end, ccp(0, -1));
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CGPoint v)
|
||||
{
|
||||
m_endColor.r = end.r;
|
||||
m_endColor.g = end.g;
|
||||
m_endColor.b = end.b;
|
||||
|
||||
m_cEndOpacity = end.a;
|
||||
m_cStartOpacity = start.a;
|
||||
m_AlongVector = v;
|
||||
|
||||
start.a = 255;
|
||||
return this->initWithColor(start);
|
||||
}
|
||||
|
||||
void CCLayerGradient::updateColor()
|
||||
{
|
||||
CCLayerColor::updateColor();
|
||||
|
||||
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
||||
if (h == 0)
|
||||
return;
|
||||
|
||||
double c = sqrt(2);
|
||||
CGPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
||||
|
||||
float opacityf = (float)m_cOpacity / 255.0f;
|
||||
|
||||
ccColor4B S = {
|
||||
m_tColor.r,
|
||||
m_tColor.g,
|
||||
m_tColor.b,
|
||||
m_cStartOpacity * opacityf
|
||||
};
|
||||
|
||||
ccColor4B E = {
|
||||
m_endColor.r,
|
||||
m_endColor.g,
|
||||
m_endColor.b,
|
||||
m_cEndOpacity * opacityf
|
||||
};
|
||||
|
||||
// (-1, -1)
|
||||
m_pSquareColors[0] = E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[1] = E.g + (S.g - E.g) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[2] = E.b + (S.b - E.b) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[3] = E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c));
|
||||
// (1, -1)
|
||||
m_pSquareColors[4] = E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[5] = E.g + (S.g - E.g) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[6] = E.b + (S.b - E.b) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[7] = E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c));
|
||||
// (-1, 1)
|
||||
m_pSquareColors[8] = E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[9] = E.g + (S.g - E.g) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[10] = E.b + (S.b - E.b) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[11] = E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c));
|
||||
// (1, 1)
|
||||
m_pSquareColors[12] = E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[13] = E.g + (S.g - E.g) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[14] = E.b + (S.b - E.b) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[15] = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c));
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getStartColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartColor(ccColor3B colors)
|
||||
{
|
||||
setColor(colors);
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndColor(ccColor3B colors)
|
||||
{
|
||||
m_endColor = colors;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getEndColor()
|
||||
{
|
||||
return m_endColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartOpacity(GLubyte o)
|
||||
{
|
||||
m_cStartOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getStartOpacity()
|
||||
{
|
||||
return m_cStartOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndOpacity(GLubyte o)
|
||||
{
|
||||
m_cEndOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getEndOpacity()
|
||||
{
|
||||
return m_cEndOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setAlongVector(CGPoint var)
|
||||
{
|
||||
m_AlongVector = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
CGPoint CCLayerGradient::getAlongVector()
|
||||
{
|
||||
return m_AlongVector;
|
||||
}
|
||||
|
||||
/// MultiplexLayer
|
||||
|
|
@ -102,7 +102,7 @@ namespace cocos2d{
|
|||
// [self alignItemsVertically];
|
||||
|
||||
m_pSelectedItem = NULL;
|
||||
m_eState = kMenuStateWaiting;
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -112,34 +112,46 @@ namespace cocos2d{
|
|||
/*
|
||||
* override add:
|
||||
*/
|
||||
CCNode * CCMenu::addChild(CCNode * child, int zOrder)
|
||||
void CCMenu::addChild(CCNode * child, int zOrder)
|
||||
{
|
||||
return CCLayer::addChild(child, zOrder);
|
||||
CCLayer::addChild(child, zOrder);
|
||||
}
|
||||
|
||||
CCNode * CCMenu::addChild(CCNode * child, int zOrder, int tag)
|
||||
void CCMenu::addChild(CCNode * child, int zOrder, int tag)
|
||||
{
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
/*NSAssert( dynamic_cast<CCMenuItem*>(child) != NULL, L"Menu only supports MenuItem objects as children");*/
|
||||
return CCLayer::addChild(child, zOrder, tag);
|
||||
CCLayer::addChild(child, zOrder, tag);
|
||||
}
|
||||
|
||||
void CCMenu::onExit()
|
||||
{
|
||||
if (m_eState == kCCMenuStateTrackingTouch)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
m_pSelectedItem = NULL;
|
||||
}
|
||||
|
||||
CCLayer::onExit();
|
||||
}
|
||||
|
||||
//Menu - Events
|
||||
void CCMenu::registerWithTouchDispatcher()
|
||||
{
|
||||
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, INT_MIN+1, true);
|
||||
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, kCCMenuTouchPriority, true);
|
||||
}
|
||||
|
||||
bool CCMenu::ccTouchBegan(CCTouch* touch, UIEvent* event)
|
||||
{
|
||||
if (m_eState != kMenuStateWaiting || ! m_bIsVisible)
|
||||
if (m_eState != kCCMenuStateWaiting || ! m_bIsVisible)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_pSelectedItem = this->itemForTouch(touch);
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_eState = kMenuStateTrackingTouch;
|
||||
m_eState = kCCMenuStateTrackingTouch;
|
||||
m_pSelectedItem->selected();
|
||||
return true;
|
||||
}
|
||||
|
@ -148,28 +160,28 @@ namespace cocos2d{
|
|||
|
||||
void CCMenu::ccTouchEnded(CCTouch *touch, UIEvent* event)
|
||||
{
|
||||
NSAssert(m_eState == kMenuStateTrackingTouch, "[Menu ccTouchEnded] -- invalid state");
|
||||
NSAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchEnded] -- invalid state");
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
m_pSelectedItem->activate();
|
||||
}
|
||||
m_eState = kMenuStateWaiting;
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
}
|
||||
|
||||
void CCMenu::ccTouchCancelled(CCTouch *touch, UIEvent* event)
|
||||
{
|
||||
NSAssert(m_eState == kMenuStateTrackingTouch, "[Menu ccTouchCancelled] -- invalid state");
|
||||
NSAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchCancelled] -- invalid state");
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
}
|
||||
m_eState = kMenuStateWaiting;
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
}
|
||||
|
||||
void CCMenu::ccTouchMoved(CCTouch* touch, UIEvent* event)
|
||||
{
|
||||
NSAssert(m_eState == kMenuStateTrackingTouch, "[Menu ccTouchMoved] -- invalid state");
|
||||
NSAssert(m_eState == kCCMenuStateTrackingTouch, "[Menu ccTouchMoved] -- invalid state");
|
||||
CCMenuItem *currentItem = this->itemForTouch(touch);
|
||||
if (currentItem != m_pSelectedItem)
|
||||
{
|
||||
|
@ -185,6 +197,36 @@ namespace cocos2d{
|
|||
}
|
||||
}
|
||||
|
||||
int CCMenu::mouseDelegatePriority()
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return -1;/** @todo upto-0.99.5 use NSIntegerMin+1 instead*/
|
||||
}
|
||||
|
||||
CCMenuItem* CCMenu::itemForMouseEvent(NSEvent * pEvent)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseUp(NSEvent * pEvent)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseDown(NSEvent * pEvent)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseDragged(NSEvent * pEvent)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
void CCMenu::destroy(void)
|
||||
{
|
||||
release();
|
|
@ -194,22 +194,22 @@ void CCTransitionScene::cleanup()
|
|||
//
|
||||
// Oriented Transition
|
||||
//
|
||||
CCOrientedTransitionScene::CCOrientedTransitionScene()
|
||||
CCTransitionSceneOriented::CCTransitionSceneOriented()
|
||||
{
|
||||
}
|
||||
CCOrientedTransitionScene::~CCOrientedTransitionScene()
|
||||
CCTransitionSceneOriented::~CCTransitionSceneOriented()
|
||||
{
|
||||
}
|
||||
|
||||
CCOrientedTransitionScene * CCOrientedTransitionScene::transitionWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
|
||||
CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
|
||||
{
|
||||
CCOrientedTransitionScene * pScene = new CCOrientedTransitionScene();
|
||||
CCTransitionSceneOriented * pScene = new CCTransitionSceneOriented();
|
||||
pScene->initWithDuration(t,scene,orientation);
|
||||
pScene->autorelease();
|
||||
return pScene;
|
||||
}
|
||||
|
||||
bool CCOrientedTransitionScene::initWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
|
||||
bool CCTransitionSceneOriented::initWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
|
||||
{
|
||||
if ( CCTransitionScene::initWithDuration(t, scene) )
|
||||
{
|
||||
|
@ -221,14 +221,14 @@ bool CCOrientedTransitionScene::initWithDuration(ccTime t, CCScene *scene, tOrie
|
|||
//
|
||||
// RotoZoom
|
||||
//
|
||||
CCRotoZoomTransition::CCRotoZoomTransition()
|
||||
CCTransitionRotoZoom::CCTransitionRotoZoom()
|
||||
{
|
||||
}
|
||||
CCRotoZoomTransition::~CCRotoZoomTransition()
|
||||
CCTransitionRotoZoom::~CCTransitionRotoZoom()
|
||||
{
|
||||
}
|
||||
|
||||
void CCRotoZoomTransition:: onEnter()
|
||||
void CCTransitionRotoZoom:: onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
|
||||
|
@ -262,20 +262,20 @@ void CCRotoZoomTransition:: onEnter()
|
|||
);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCRotoZoomTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionRotoZoom)
|
||||
|
||||
|
||||
//
|
||||
// JumpZoom
|
||||
//
|
||||
CCJumpZoomTransition::CCJumpZoomTransition()
|
||||
CCTransitionJumpZoom::CCTransitionJumpZoom()
|
||||
{
|
||||
}
|
||||
CCJumpZoomTransition::~CCJumpZoomTransition()
|
||||
CCTransitionJumpZoom::~CCTransitionJumpZoom()
|
||||
{
|
||||
}
|
||||
|
||||
void CCJumpZoomTransition::onEnter()
|
||||
void CCTransitionJumpZoom::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
@ -307,19 +307,19 @@ void CCJumpZoomTransition::onEnter()
|
|||
);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCJumpZoomTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionJumpZoom)
|
||||
|
||||
//
|
||||
// MoveInL
|
||||
//
|
||||
CCMoveInLTransition::CCMoveInLTransition()
|
||||
CCTransitionMoveInL::CCTransitionMoveInL()
|
||||
{
|
||||
}
|
||||
CCMoveInLTransition::~CCMoveInLTransition()
|
||||
CCTransitionMoveInL::~CCTransitionMoveInL()
|
||||
{
|
||||
}
|
||||
|
||||
void CCMoveInLTransition::onEnter()
|
||||
void CCTransitionMoveInL::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
this->initScenes();
|
||||
|
@ -337,78 +337,78 @@ void CCMoveInLTransition::onEnter()
|
|||
);
|
||||
}
|
||||
|
||||
CCActionInterval* CCMoveInLTransition::action()
|
||||
CCActionInterval* CCTransitionMoveInL::action()
|
||||
{
|
||||
return CCMoveTo::actionWithDuration(m_fDuration, ccp(0,0));
|
||||
}
|
||||
|
||||
CCActionInterval* CCMoveInLTransition::easeActionWithAction(CCActionInterval* action)
|
||||
CCActionInterval* CCTransitionMoveInL::easeActionWithAction(CCActionInterval* action)
|
||||
{
|
||||
return CCEaseOut::actionWithAction(action, 2.0f);
|
||||
// return [EaseElasticOut actionWithAction:action period:0.4f];
|
||||
}
|
||||
|
||||
void CCMoveInLTransition::initScenes()
|
||||
void CCTransitionMoveInL::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(-s.width,0) );
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCMoveInLTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInL)
|
||||
|
||||
//
|
||||
// MoveInR
|
||||
//
|
||||
CCMoveInRTransition::CCMoveInRTransition()
|
||||
CCTransitionMoveInR::CCTransitionMoveInR()
|
||||
{
|
||||
}
|
||||
CCMoveInRTransition::~CCMoveInRTransition()
|
||||
CCTransitionMoveInR::~CCTransitionMoveInR()
|
||||
{
|
||||
}
|
||||
|
||||
void CCMoveInRTransition::initScenes()
|
||||
void CCTransitionMoveInR::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(s.width,0) );
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCMoveInRTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInR)
|
||||
|
||||
//
|
||||
// MoveInT
|
||||
//
|
||||
CCMoveInTTransition::CCMoveInTTransition()
|
||||
CCTransitionMoveInT::CCTransitionMoveInT()
|
||||
{
|
||||
}
|
||||
CCMoveInTTransition::~CCMoveInTTransition()
|
||||
CCTransitionMoveInT::~CCTransitionMoveInT()
|
||||
{
|
||||
}
|
||||
|
||||
void CCMoveInTTransition::initScenes()
|
||||
void CCTransitionMoveInT::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(0,s.height) );
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCMoveInTTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInT)
|
||||
|
||||
//
|
||||
// MoveInB
|
||||
//
|
||||
CCMoveInBTransition::CCMoveInBTransition()
|
||||
CCTransitionMoveInB::CCTransitionMoveInB()
|
||||
{
|
||||
}
|
||||
CCMoveInBTransition::~CCMoveInBTransition()
|
||||
CCTransitionMoveInB::~CCTransitionMoveInB()
|
||||
{
|
||||
}
|
||||
|
||||
void CCMoveInBTransition::initScenes()
|
||||
void CCTransitionMoveInB::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(0,-s.height) );
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCMoveInBTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInB)
|
||||
|
||||
|
||||
//
|
||||
|
@ -420,14 +420,14 @@ IMPLEMENT_TRANSITIONWITHDURATION(CCMoveInBTransition)
|
|||
// The other issue is that in some transitions (and I don't know why)
|
||||
// the order should be reversed (In in top of Out or vice-versa).
|
||||
#define ADJUST_FACTOR 0.5f
|
||||
CCSlideInLTransition::CCSlideInLTransition()
|
||||
CCTransitionSlideInL::CCTransitionSlideInL()
|
||||
{
|
||||
}
|
||||
CCSlideInLTransition::~CCSlideInLTransition()
|
||||
CCTransitionSlideInL::~CCTransitionSlideInL()
|
||||
{
|
||||
}
|
||||
|
||||
void CCSlideInLTransition::onEnter()
|
||||
void CCTransitionSlideInL::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
this->initScenes();
|
||||
|
@ -446,134 +446,134 @@ void CCSlideInLTransition::onEnter()
|
|||
m_pOutScene->runAction(outAction);
|
||||
}
|
||||
|
||||
void CCSlideInLTransition::sceneOrder()
|
||||
void CCTransitionSlideInL::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = false;
|
||||
}
|
||||
|
||||
void CCSlideInLTransition:: initScenes()
|
||||
void CCTransitionSlideInL:: initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(-(s.width-ADJUST_FACTOR),0) );
|
||||
}
|
||||
|
||||
CCActionInterval* CCSlideInLTransition::action()
|
||||
CCActionInterval* CCTransitionSlideInL::action()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCMoveBy::actionWithDuration(m_fDuration, ccp(s.width-ADJUST_FACTOR,0));
|
||||
}
|
||||
|
||||
CCActionInterval* CCSlideInLTransition::easeActionWithAction(CCActionInterval* action)
|
||||
CCActionInterval* CCTransitionSlideInL::easeActionWithAction(CCActionInterval* action)
|
||||
{
|
||||
return CCEaseOut::actionWithAction(action, 2.0f);
|
||||
// return [EaseElasticOut actionWithAction:action period:0.4f];
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSlideInLTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInL)
|
||||
|
||||
|
||||
//
|
||||
// SlideInR
|
||||
//
|
||||
CCSlideInRTransition::CCSlideInRTransition()
|
||||
CCTransitionSlideInR::CCTransitionSlideInR()
|
||||
{
|
||||
}
|
||||
CCSlideInRTransition::~CCSlideInRTransition()
|
||||
CCTransitionSlideInR::~CCTransitionSlideInR()
|
||||
{
|
||||
}
|
||||
|
||||
void CCSlideInRTransition::sceneOrder()
|
||||
void CCTransitionSlideInR::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = true;
|
||||
}
|
||||
|
||||
void CCSlideInRTransition::initScenes()
|
||||
void CCTransitionSlideInR::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(s.width-ADJUST_FACTOR,0) );
|
||||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSlideInRTransition:: action()
|
||||
CCActionInterval* CCTransitionSlideInR:: action()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCMoveBy::actionWithDuration(m_fDuration, ccp(-(s.width-ADJUST_FACTOR),0));
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSlideInRTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInR)
|
||||
|
||||
|
||||
//
|
||||
// SlideInT
|
||||
//
|
||||
CCSlideInTTransition::CCSlideInTTransition()
|
||||
CCTransitionSlideInT::CCTransitionSlideInT()
|
||||
{
|
||||
}
|
||||
CCSlideInTTransition::~CCSlideInTTransition()
|
||||
CCTransitionSlideInT::~CCTransitionSlideInT()
|
||||
{
|
||||
}
|
||||
|
||||
void CCSlideInTTransition::sceneOrder()
|
||||
void CCTransitionSlideInT::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = false;
|
||||
}
|
||||
|
||||
void CCSlideInTTransition::initScenes()
|
||||
void CCTransitionSlideInT::initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(0,s.height-ADJUST_FACTOR) );
|
||||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSlideInTTransition::action()
|
||||
CCActionInterval* CCTransitionSlideInT::action()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,-(s.height-ADJUST_FACTOR)));
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSlideInTTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInT)
|
||||
|
||||
//
|
||||
// SlideInB
|
||||
//
|
||||
CCSlideInBTransition::CCSlideInBTransition()
|
||||
CCTransitionSlideInB::CCTransitionSlideInB()
|
||||
{
|
||||
}
|
||||
CCSlideInBTransition::~CCSlideInBTransition()
|
||||
CCTransitionSlideInB::~CCTransitionSlideInB()
|
||||
{
|
||||
}
|
||||
|
||||
void CCSlideInBTransition::sceneOrder()
|
||||
void CCTransitionSlideInB::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = true;
|
||||
}
|
||||
|
||||
void CCSlideInBTransition:: initScenes()
|
||||
void CCTransitionSlideInB:: initScenes()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
m_pInScene->setPosition( ccp(0,-(s.height-ADJUST_FACTOR)) );
|
||||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSlideInBTransition:: action()
|
||||
CCActionInterval* CCTransitionSlideInB:: action()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,s.height-ADJUST_FACTOR));
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSlideInBTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInB)
|
||||
|
||||
//
|
||||
// ShrinkGrow Transition
|
||||
//
|
||||
CCShrinkGrowTransition::CCShrinkGrowTransition()
|
||||
CCTransitionShrinkGrow::CCTransitionShrinkGrow()
|
||||
{
|
||||
}
|
||||
CCShrinkGrowTransition::~CCShrinkGrowTransition()
|
||||
CCTransitionShrinkGrow::~CCTransitionShrinkGrow()
|
||||
{
|
||||
}
|
||||
|
||||
void CCShrinkGrowTransition::onEnter()
|
||||
void CCTransitionShrinkGrow::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
|
||||
|
@ -597,27 +597,27 @@ void CCShrinkGrowTransition::onEnter()
|
|||
)
|
||||
);
|
||||
}
|
||||
CCActionInterval* CCShrinkGrowTransition:: easeActionWithAction(CCActionInterval* action)
|
||||
CCActionInterval* CCTransitionShrinkGrow:: easeActionWithAction(CCActionInterval* action)
|
||||
{
|
||||
return CCEaseOut::actionWithAction(action, 2.0f);
|
||||
// return [EaseElasticOut actionWithAction:action period:0.3f];
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCShrinkGrowTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionShrinkGrow)
|
||||
|
||||
//
|
||||
// FlipX Transition
|
||||
//
|
||||
CCFlipXTransition::CCFlipXTransition()
|
||||
CCTransitionFlipX::CCTransitionFlipX()
|
||||
{
|
||||
}
|
||||
CCFlipXTransition::~CCFlipXTransition()
|
||||
CCTransitionFlipX::~CCTransitionFlipX()
|
||||
{
|
||||
}
|
||||
|
||||
void CCFlipXTransition::onEnter()
|
||||
void CCTransitionFlipX::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -661,9 +661,9 @@ void CCFlipXTransition::onEnter()
|
|||
m_pOutScene->runAction(outA);
|
||||
}
|
||||
|
||||
CCFlipXTransition* CCFlipXTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionFlipX* CCTransitionFlipX::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCFlipXTransition* pScene = new CCFlipXTransition();
|
||||
CCTransitionFlipX* pScene = new CCTransitionFlipX();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -673,16 +673,16 @@ CCFlipXTransition* CCFlipXTransition::transitionWithDuration(ccTime t, CCScene*
|
|||
//
|
||||
// FlipY Transition
|
||||
//
|
||||
CCFlipYTransition::CCFlipYTransition()
|
||||
CCTransitionFlipY::CCTransitionFlipY()
|
||||
{
|
||||
}
|
||||
CCFlipYTransition::~CCFlipYTransition()
|
||||
CCTransitionFlipY::~CCTransitionFlipY()
|
||||
{
|
||||
}
|
||||
|
||||
void CCFlipYTransition::onEnter()
|
||||
void CCTransitionFlipY::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -726,9 +726,9 @@ void CCFlipYTransition::onEnter()
|
|||
|
||||
}
|
||||
|
||||
CCFlipYTransition* CCFlipYTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCFlipYTransition* pScene = new CCFlipYTransition();
|
||||
CCTransitionFlipY* pScene = new CCTransitionFlipY();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -738,16 +738,16 @@ CCFlipYTransition* CCFlipYTransition::transitionWithDuration(ccTime t, CCScene*
|
|||
//
|
||||
// FlipAngular Transition
|
||||
//
|
||||
CCFlipAngularTransition::CCFlipAngularTransition()
|
||||
CCTransitionFlipAngular::CCTransitionFlipAngular()
|
||||
{
|
||||
}
|
||||
CCFlipAngularTransition::~CCFlipAngularTransition()
|
||||
CCTransitionFlipAngular::~CCTransitionFlipAngular()
|
||||
{
|
||||
}
|
||||
|
||||
void CCFlipAngularTransition::onEnter()
|
||||
void CCTransitionFlipAngular::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -790,9 +790,9 @@ void CCFlipAngularTransition::onEnter()
|
|||
m_pOutScene->runAction(outA);
|
||||
}
|
||||
|
||||
CCFlipAngularTransition* CCFlipAngularTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionFlipAngular* CCTransitionFlipAngular::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCFlipAngularTransition* pScene = new CCFlipAngularTransition();
|
||||
CCTransitionFlipAngular* pScene = new CCTransitionFlipAngular();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -802,16 +802,16 @@ CCFlipAngularTransition* CCFlipAngularTransition::transitionWithDuration(ccTime
|
|||
//
|
||||
// ZoomFlipX Transition
|
||||
//
|
||||
CCZoomFlipXTransition::CCZoomFlipXTransition()
|
||||
CCTransitionZoomFlipX::CCTransitionZoomFlipX()
|
||||
{
|
||||
}
|
||||
CCZoomFlipXTransition::~CCZoomFlipXTransition()
|
||||
CCTransitionZoomFlipX::~CCTransitionZoomFlipX()
|
||||
{
|
||||
}
|
||||
|
||||
void CCZoomFlipXTransition::onEnter()
|
||||
void CCTransitionZoomFlipX::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -863,9 +863,9 @@ void CCZoomFlipXTransition::onEnter()
|
|||
m_pOutScene->runAction(outA);
|
||||
}
|
||||
|
||||
CCZoomFlipXTransition* CCZoomFlipXTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCZoomFlipXTransition* pScene = new CCZoomFlipXTransition();
|
||||
CCTransitionZoomFlipX* pScene = new CCTransitionZoomFlipX();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -875,16 +875,16 @@ CCZoomFlipXTransition* CCZoomFlipXTransition::transitionWithDuration(ccTime t, C
|
|||
//
|
||||
// ZoomFlipY Transition
|
||||
//
|
||||
CCZoomFlipYTransition::CCZoomFlipYTransition()
|
||||
CCTransitionZoomFlipY::CCTransitionZoomFlipY()
|
||||
{
|
||||
}
|
||||
CCZoomFlipYTransition::~CCZoomFlipYTransition()
|
||||
CCTransitionZoomFlipY::~CCTransitionZoomFlipY()
|
||||
{
|
||||
}
|
||||
|
||||
void CCZoomFlipYTransition::onEnter()
|
||||
void CCTransitionZoomFlipY::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -936,9 +936,9 @@ void CCZoomFlipYTransition::onEnter()
|
|||
m_pOutScene->runAction(outA);
|
||||
}
|
||||
|
||||
CCZoomFlipYTransition* CCZoomFlipYTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionZoomFlipY* CCTransitionZoomFlipY::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCZoomFlipYTransition* pScene = new CCZoomFlipYTransition();
|
||||
CCTransitionZoomFlipY* pScene = new CCTransitionZoomFlipY();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -948,17 +948,17 @@ CCZoomFlipYTransition* CCZoomFlipYTransition::transitionWithDuration(ccTime t, C
|
|||
//
|
||||
// ZoomFlipAngular Transition
|
||||
//
|
||||
CCZoomFlipAngularTransition::CCZoomFlipAngularTransition()
|
||||
CCTransitionZoomFlipAngular::CCTransitionZoomFlipAngular()
|
||||
{
|
||||
}
|
||||
CCZoomFlipAngularTransition::~CCZoomFlipAngularTransition()
|
||||
CCTransitionZoomFlipAngular::~CCTransitionZoomFlipAngular()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CCZoomFlipAngularTransition::onEnter()
|
||||
void CCTransitionZoomFlipAngular::onEnter()
|
||||
{
|
||||
CCOrientedTransitionScene::onEnter();
|
||||
CCTransitionSceneOriented::onEnter();
|
||||
|
||||
CCActionInterval *inA, *outA;
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -1012,9 +1012,9 @@ void CCZoomFlipAngularTransition::onEnter()
|
|||
m_pOutScene->runAction(outA);
|
||||
}
|
||||
|
||||
CCZoomFlipAngularTransition* CCZoomFlipAngularTransition::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
|
||||
{
|
||||
CCZoomFlipAngularTransition* pScene = new CCZoomFlipAngularTransition();
|
||||
CCTransitionZoomFlipAngular* pScene = new CCTransitionZoomFlipAngular();
|
||||
pScene->initWithDuration(t, s, o);
|
||||
pScene->autorelease();
|
||||
|
||||
|
@ -1024,23 +1024,23 @@ CCZoomFlipAngularTransition* CCZoomFlipAngularTransition::transitionWithDuration
|
|||
//
|
||||
// Fade Transition
|
||||
//
|
||||
CCFadeTransition::CCFadeTransition()
|
||||
CCTransitionFade::CCTransitionFade()
|
||||
{
|
||||
}
|
||||
CCFadeTransition::~CCFadeTransition()
|
||||
CCTransitionFade::~CCTransitionFade()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCFadeTransition * CCFadeTransition::transitionWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
|
||||
CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
|
||||
{
|
||||
CCFadeTransition * pTransition = new CCFadeTransition();
|
||||
CCTransitionFade * pTransition = new CCTransitionFade();
|
||||
pTransition->initWithDuration(duration, scene, color);
|
||||
pTransition->autorelease();
|
||||
return pTransition;
|
||||
}
|
||||
|
||||
bool CCFadeTransition::initWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
|
||||
bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
|
||||
{
|
||||
if (CCTransitionScene::initWithDuration(duration, scene))
|
||||
{
|
||||
|
@ -1051,17 +1051,17 @@ bool CCFadeTransition::initWithDuration(ccTime duration, CCScene *scene, ccColor
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CCFadeTransition::initWithDuration(ccTime t, CCScene *scene)
|
||||
bool CCTransitionFade::initWithDuration(ccTime t, CCScene *scene)
|
||||
{
|
||||
this->initWithDuration(t, scene, ccBLACK);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCFadeTransition :: onEnter()
|
||||
void CCTransitionFade :: onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
|
||||
CCColorLayer* l = CCColorLayer::layerWithColor(m_tColor);
|
||||
CCLayerColor* l = CCLayerColor::layerWithColor(m_tColor);
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
||||
addChild(l, 2, kSceneFade);
|
||||
|
@ -1078,7 +1078,7 @@ void CCFadeTransition :: onEnter()
|
|||
f->runAction(a);
|
||||
}
|
||||
|
||||
void CCFadeTransition::onExit()
|
||||
void CCTransitionFade::onExit()
|
||||
{
|
||||
CCTransitionScene::onExit();
|
||||
this->removeChildByTag(kSceneFade, false);
|
||||
|
@ -1087,20 +1087,20 @@ void CCFadeTransition::onExit()
|
|||
//
|
||||
// Cross Fade Transition
|
||||
//
|
||||
CCCrossFadeTransition::CCCrossFadeTransition()
|
||||
CCTransitionCrossFade::CCTransitionCrossFade()
|
||||
{
|
||||
}
|
||||
CCCrossFadeTransition::~CCCrossFadeTransition()
|
||||
CCTransitionCrossFade::~CCTransitionCrossFade()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CCCrossFadeTransition:: draw()
|
||||
void CCTransitionCrossFade:: draw()
|
||||
{
|
||||
// override draw since both scenes (textures) are rendered in 1 scene
|
||||
}
|
||||
|
||||
void CCCrossFadeTransition::onEnter()
|
||||
void CCTransitionCrossFade::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
|
||||
|
@ -1108,7 +1108,7 @@ void CCCrossFadeTransition::onEnter()
|
|||
// in which we are going to add our rendertextures
|
||||
ccColor4B color = {0,0,0,0};
|
||||
CGSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
CCColorLayer* layer = CCColorLayer::layerWithColor(color);
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor(color);
|
||||
|
||||
// create the first render texture for inScene
|
||||
CCRenderTexture* inTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
|
||||
|
@ -1167,16 +1167,16 @@ void CCCrossFadeTransition::onEnter()
|
|||
}
|
||||
|
||||
// clean up on exit
|
||||
void CCCrossFadeTransition::onExit()
|
||||
void CCTransitionCrossFade::onExit()
|
||||
{
|
||||
// remove our layer and release all containing objects
|
||||
this->removeChildByTag(kSceneFade, false);
|
||||
CCTransitionScene::onExit();
|
||||
}
|
||||
|
||||
CCCrossFadeTransition* CCCrossFadeTransition::transitionWithDuration(ccTime d, CCScene* s)
|
||||
CCTransitionCrossFade* CCTransitionCrossFade::transitionWithDuration(ccTime d, CCScene* s)
|
||||
{
|
||||
CCCrossFadeTransition* Transition = new CCCrossFadeTransition();
|
||||
CCTransitionCrossFade* Transition = new CCTransitionCrossFade();
|
||||
Transition->initWithDuration(d, s);
|
||||
Transition->autorelease();
|
||||
|
||||
|
@ -1186,21 +1186,21 @@ CCCrossFadeTransition* CCCrossFadeTransition::transitionWithDuration(ccTime d, C
|
|||
//
|
||||
// TurnOffTilesTransition
|
||||
//
|
||||
CCTurnOffTilesTransition::CCTurnOffTilesTransition()
|
||||
CCTransitionTurnOffTiles::CCTransitionTurnOffTiles()
|
||||
{
|
||||
}
|
||||
CCTurnOffTilesTransition::~CCTurnOffTilesTransition()
|
||||
CCTransitionTurnOffTiles::~CCTransitionTurnOffTiles()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// override addScenes, and change the order
|
||||
void CCTurnOffTilesTransition::sceneOrder()
|
||||
void CCTransitionTurnOffTiles::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = false;
|
||||
}
|
||||
|
||||
void CCTurnOffTilesTransition::onEnter()
|
||||
void CCTransitionTurnOffTiles::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
@ -1223,25 +1223,25 @@ void CCTurnOffTilesTransition::onEnter()
|
|||
}
|
||||
|
||||
|
||||
CCActionInterval* CCTurnOffTilesTransition:: easeActionWithAction(CCActionInterval* action)
|
||||
CCActionInterval* CCTransitionTurnOffTiles:: easeActionWithAction(CCActionInterval* action)
|
||||
{
|
||||
return action;
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTurnOffTilesTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionTurnOffTiles)
|
||||
|
||||
//
|
||||
// SplitCols Transition
|
||||
//
|
||||
CCSplitColsTransition::CCSplitColsTransition()
|
||||
CCTransitionSplitCols::CCTransitionSplitCols()
|
||||
{
|
||||
}
|
||||
CCSplitColsTransition::~CCSplitColsTransition()
|
||||
CCTransitionSplitCols::~CCTransitionSplitCols()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CCSplitColsTransition::onEnter()
|
||||
void CCTransitionSplitCols::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
m_pInScene->setIsVisible(false);
|
||||
|
@ -1268,55 +1268,55 @@ void CCSplitColsTransition::onEnter()
|
|||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSplitColsTransition:: action()
|
||||
CCActionInterval* CCTransitionSplitCols:: action()
|
||||
{
|
||||
return CCSplitCols::actionWithCols(3, m_fDuration/2.0f);
|
||||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSplitColsTransition::easeActionWithAction(CCActionInterval * action)
|
||||
CCActionInterval* CCTransitionSplitCols::easeActionWithAction(CCActionInterval * action)
|
||||
{
|
||||
return CCEaseInOut::actionWithAction(action, 3.0f);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSplitColsTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSplitCols)
|
||||
|
||||
|
||||
//
|
||||
// SplitRows Transition
|
||||
//
|
||||
CCSplitRowsTransition::CCSplitRowsTransition()
|
||||
CCTransitionSplitRows::CCTransitionSplitRows()
|
||||
{
|
||||
}
|
||||
CCSplitRowsTransition::~CCSplitRowsTransition()
|
||||
CCTransitionSplitRows::~CCTransitionSplitRows()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCActionInterval* CCSplitRowsTransition::action()
|
||||
CCActionInterval* CCTransitionSplitRows::action()
|
||||
{
|
||||
return CCSplitRows::actionWithRows(3, m_fDuration/2.0f);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCSplitRowsTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSplitRows)
|
||||
|
||||
//
|
||||
// FadeTR Transition
|
||||
//
|
||||
CCFadeTRTransition::CCFadeTRTransition()
|
||||
CCTransitionFadeTR::CCTransitionFadeTR()
|
||||
{
|
||||
}
|
||||
CCFadeTRTransition::~CCFadeTRTransition()
|
||||
CCTransitionFadeTR::~CCTransitionFadeTR()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CCFadeTRTransition::sceneOrder()
|
||||
void CCTransitionFadeTR::sceneOrder()
|
||||
{
|
||||
m_bIsInSceneOnTop = false;
|
||||
}
|
||||
|
||||
void CCFadeTRTransition::onEnter()
|
||||
void CCTransitionFadeTR::onEnter()
|
||||
{
|
||||
CCTransitionScene::onEnter();
|
||||
|
||||
|
@ -1340,69 +1340,69 @@ void CCFadeTRTransition::onEnter()
|
|||
}
|
||||
|
||||
|
||||
CCActionInterval* CCFadeTRTransition::actionWithSize(ccGridSize size)
|
||||
CCActionInterval* CCTransitionFadeTR::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return CCFadeOutTRTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeTRTransition:: easeActionWithAction(CCActionInterval* action)
|
||||
CCActionInterval* CCTransitionFadeTR:: easeActionWithAction(CCActionInterval* action)
|
||||
{
|
||||
return action;
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeTRTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeTR)
|
||||
|
||||
|
||||
//
|
||||
// FadeBL Transition
|
||||
//
|
||||
|
||||
CCFadeBLTransition::CCFadeBLTransition()
|
||||
CCTransitionFadeBL::CCTransitionFadeBL()
|
||||
{
|
||||
}
|
||||
CCFadeBLTransition::~CCFadeBLTransition()
|
||||
CCTransitionFadeBL::~CCTransitionFadeBL()
|
||||
{
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeBLTransition::actionWithSize(ccGridSize size)
|
||||
CCActionInterval* CCTransitionFadeBL::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return CCFadeOutBLTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeBLTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeBL)
|
||||
|
||||
//
|
||||
// FadeUp Transition
|
||||
//
|
||||
CCFadeUpTransition::CCFadeUpTransition()
|
||||
CCTransitionFadeUp::CCTransitionFadeUp()
|
||||
{
|
||||
}
|
||||
CCFadeUpTransition::~CCFadeUpTransition()
|
||||
CCTransitionFadeUp::~CCTransitionFadeUp()
|
||||
{
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeUpTransition::actionWithSize(ccGridSize size)
|
||||
CCActionInterval* CCTransitionFadeUp::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return CCFadeOutUpTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeUpTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeUp)
|
||||
|
||||
//
|
||||
// FadeDown Transition
|
||||
//
|
||||
CCFadeDownTransition::CCFadeDownTransition()
|
||||
CCTransitionFadeDown::CCTransitionFadeDown()
|
||||
{
|
||||
}
|
||||
CCFadeDownTransition::~CCFadeDownTransition()
|
||||
CCTransitionFadeDown::~CCTransitionFadeDown()
|
||||
{
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeDownTransition::actionWithSize(ccGridSize size)
|
||||
CCActionInterval* CCTransitionFadeDown::actionWithSize(ccGridSize size)
|
||||
{
|
||||
return CCFadeOutDownTiles::actionWithSize(size, m_fDuration);
|
||||
}
|
||||
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCFadeDownTransition)
|
||||
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeDown)
|
||||
|
||||
}//namespace cocos2d
|
|
@ -0,0 +1,658 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "CCLayer.h"
|
||||
#include "CCTouchDispatcher.h"
|
||||
#include "CCKeypadDispatcher.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CGPointExtension.h"
|
||||
namespace cocos2d {
|
||||
|
||||
// CCLayer
|
||||
CCLayer::CCLayer()
|
||||
:m_bIsTouchEnabled(false)
|
||||
,m_bIsAccelerometerEnabled(false)
|
||||
,m_bIsKeypadEnabled(false)
|
||||
,m_bIsMouseEnabled(false)
|
||||
,m_bIsKeyboardEnabled(false)
|
||||
{
|
||||
m_eTouchDelegateType = ccTouchDeletateAllBit;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
m_bIsRelativeAnchorPoint = false;
|
||||
}
|
||||
|
||||
CCLayer::~CCLayer()
|
||||
{
|
||||
}
|
||||
|
||||
bool CCLayer::init()
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CCDirector * pDirector;
|
||||
CCX_BREAK_IF( ! (pDirector = CCDirector::sharedDirector()) );
|
||||
this->setContentSize(pDirector->getWinSize());
|
||||
// success
|
||||
bRet = true;
|
||||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
CCLayer *CCLayer::node()
|
||||
{
|
||||
CCLayer *pRet = new CCLayer();
|
||||
if (pRet && pRet->init())
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/// Touch and Accelerometer related
|
||||
|
||||
void CCLayer::registerWithTouchDispatcher()
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupported!");
|
||||
}
|
||||
|
||||
void CCLayer::destroy(void)
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::keep(void)
|
||||
{
|
||||
this->retain();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerDestroy(void)
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerKeep(void)
|
||||
{
|
||||
this->retain();
|
||||
}
|
||||
|
||||
void CCLayer::KeypadDestroy()
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::KeypadKeep()
|
||||
{
|
||||
this->retain();
|
||||
}
|
||||
|
||||
bool CCLayer::getIsMouseEnabled()
|
||||
{
|
||||
return m_bIsMouseEnabled;
|
||||
}
|
||||
|
||||
void CCLayer::setIsMouseEnabled(bool enabled)
|
||||
{
|
||||
if( m_bIsMouseEnabled != enabled )
|
||||
{
|
||||
m_bIsMouseEnabled = enabled;
|
||||
|
||||
if( m_bIsRunning )
|
||||
{
|
||||
if( enabled )
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->addMouseDelegate(this, mouseDelegatePriority());
|
||||
}
|
||||
else
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->removeMouseDelegate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CCLayer::getIsKeyboardEnabled()
|
||||
{
|
||||
return m_bIsKeyboardEnabled;
|
||||
}
|
||||
|
||||
void CCLayer::setIsKeyboardEnabled(bool enabled)
|
||||
{
|
||||
if( m_bIsKeyboardEnabled != enabled )
|
||||
{
|
||||
m_bIsKeyboardEnabled = enabled;
|
||||
|
||||
if( m_bIsRunning )
|
||||
{
|
||||
if( enabled )
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->addKeyboardDelegate(this, keyboardDelegatePriority());
|
||||
}
|
||||
else
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->removeKeyboardDelegate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// isTouchEnabled getter
|
||||
bool CCLayer::getIsTouchEnabled()
|
||||
{
|
||||
return m_bIsTouchEnabled;
|
||||
}
|
||||
/// isTouchEnabled setter
|
||||
void CCLayer::setIsTouchEnabled(bool enabled)
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupported!");
|
||||
}
|
||||
|
||||
/// isAccelerometerEnabled getter
|
||||
bool CCLayer::getIsAccelerometerEnabled()
|
||||
{
|
||||
return m_bIsAccelerometerEnabled;
|
||||
}
|
||||
/// isAccelerometerEnabled setter
|
||||
void CCLayer::setIsAccelerometerEnabled(bool enabled)
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupported!");
|
||||
}
|
||||
|
||||
/// isKeypadEnabled getter
|
||||
bool CCLayer::getIsKeypadEnabled()
|
||||
{
|
||||
return m_bIsKeypadEnabled;
|
||||
}
|
||||
/// isKeypadEnabled setter
|
||||
void CCLayer::setIsKeypadEnabled(bool enabled)
|
||||
{
|
||||
if (enabled != m_bIsKeypadEnabled)
|
||||
{
|
||||
m_bIsKeypadEnabled = enabled;
|
||||
|
||||
if (m_bIsRunning)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->addDelegate(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->removeDelegate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Callbacks
|
||||
void CCLayer::onEnter()
|
||||
{
|
||||
if(m_bIsMouseEnabled)
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->addMouseDelegate(this, mouseDelegatePriority());
|
||||
}
|
||||
|
||||
if( m_bIsKeyboardEnabled)
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->addKeyboardDelegate(this, keyboardDelegatePriority());
|
||||
}
|
||||
|
||||
// then iterate over all the children
|
||||
CCNode::onEnter();
|
||||
|
||||
// add this layer to concern the kaypad msg
|
||||
if (m_bIsKeypadEnabled)
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->addDelegate(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayer::onExit()
|
||||
{
|
||||
if(m_bIsMouseEnabled)
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->removeMouseDelegate(this, mouseDelegatePriority());
|
||||
}
|
||||
|
||||
if( m_bIsKeyboardEnabled)
|
||||
{
|
||||
CCEventDispatcher::sharedDispatcher()->removeKeyboardDelegate(this, keyboardDelegatePriority());
|
||||
}
|
||||
|
||||
// remove this layer from the delegates who concern the kaypad msg
|
||||
if (m_bIsKeypadEnabled)
|
||||
{
|
||||
CCKeypadDispatcher::sharedDispatcher()->removeDelegate(this);
|
||||
}
|
||||
|
||||
CCNode::onExit();
|
||||
}
|
||||
|
||||
void CCLayer::onEnterTransitionDidFinish()
|
||||
{
|
||||
CCNode::onEnterTransitionDidFinish();
|
||||
}
|
||||
|
||||
bool CCLayer::ccTouchBegan(CCTouch *pTouch, UIEvent *pEvent)
|
||||
{
|
||||
CCLOG("cocos2d: CCLayer: unsupported!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// ColorLayer
|
||||
//
|
||||
CCLayerColor::CCLayerColor()
|
||||
{
|
||||
}
|
||||
CCLayerColor::~CCLayerColor()
|
||||
{
|
||||
}
|
||||
|
||||
// Opacity and RGB color protocol
|
||||
/// opacity getter
|
||||
GLubyte CCLayerColor::getOpacity()
|
||||
{
|
||||
return m_cOpacity;
|
||||
}
|
||||
/// opacity setter
|
||||
void CCLayerColor::setOpacity(GLubyte var)
|
||||
{
|
||||
m_cOpacity = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
/// color getter
|
||||
ccColor3B CCLayerColor::getColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
/// color setter
|
||||
void CCLayerColor::setColor(ccColor3B var)
|
||||
{
|
||||
m_tColor = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
|
||||
/// blendFunc getter
|
||||
ccBlendFunc CCLayerColor::getBlendFunc()
|
||||
{
|
||||
return m_tBlendFunc;
|
||||
}
|
||||
/// blendFunc setter
|
||||
void CCLayerColor::setBlendFunc(ccBlendFunc var)
|
||||
{
|
||||
m_tBlendFunc = var;
|
||||
}
|
||||
|
||||
|
||||
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
{
|
||||
CCLayerColor * pLayer = new CCLayerColor();
|
||||
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color)
|
||||
{
|
||||
CCLayerColor * pLayer = new CCLayerColor();
|
||||
if(pLayer && pLayer->initWithColor(color))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
{
|
||||
// default blend function
|
||||
m_tBlendFunc.src = CC_BLEND_SRC;
|
||||
m_tBlendFunc.dst = CC_BLEND_DST;
|
||||
|
||||
m_tColor.r = color.r;
|
||||
m_tColor.g = color.g;
|
||||
m_tColor.b = color.b;
|
||||
m_cOpacity = color.a;
|
||||
|
||||
for (unsigned int i=0; i<sizeof(m_pSquareVertices) / sizeof(m_pSquareVertices[0]); i++ )
|
||||
{
|
||||
m_pSquareVertices[i] = 0.0f;
|
||||
}
|
||||
|
||||
this->updateColor();
|
||||
this->setContentSize(CGSizeMake(width,height));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCLayerColor::initWithColor(ccColor4B color)
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
this->initWithColorWidthHeight(color, s.width, s.height);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// override contentSize
|
||||
void CCLayerColor::setContentSize(CGSize size)
|
||||
{
|
||||
m_pSquareVertices[2] = size.width * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[5] = size.height * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[6] = size.width * CC_CONTENT_SCALE_FACTOR();
|
||||
m_pSquareVertices[7] = size.height * CC_CONTENT_SCALE_FACTOR();
|
||||
|
||||
CCLayer::setContentSize(size);
|
||||
}
|
||||
|
||||
void CCLayerColor::changeWidthAndHeight(GLfloat w ,GLfloat h)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(w, h));
|
||||
}
|
||||
|
||||
void CCLayerColor::changeWidth(GLfloat w)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(w, m_tContentSize.height));
|
||||
}
|
||||
|
||||
void CCLayerColor::changeHeight(GLfloat h)
|
||||
{
|
||||
this->setContentSize(CGSizeMake(m_tContentSize.width, h));
|
||||
}
|
||||
|
||||
void CCLayerColor::updateColor()
|
||||
{
|
||||
for( unsigned int i=0; i < 4; i++ )
|
||||
{
|
||||
m_pSquareColors[i * 4] = m_tColor.r;
|
||||
m_pSquareColors[i * 4 + 1] = m_tColor.g;
|
||||
m_pSquareColors[i * 4 + 2] = m_tColor.b;
|
||||
m_pSquareColors[i * 4 + 3] = m_cOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
void CCLayerColor::draw()
|
||||
{
|
||||
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
|
||||
// Needed states: GL_VERTEX_ARRAY, GL_COLOR_ARRAY
|
||||
// Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glVertexPointer(2, GL_FLOAT, 0, m_pSquareVertices);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, m_pSquareColors);
|
||||
|
||||
bool newBlend = false;
|
||||
if( m_tBlendFunc.src != CC_BLEND_SRC || m_tBlendFunc.dst != CC_BLEND_DST ) {
|
||||
newBlend = true;
|
||||
glBlendFunc(m_tBlendFunc.src, m_tBlendFunc.dst);
|
||||
}
|
||||
else if( m_cOpacity != 255 ) {
|
||||
newBlend = true;
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if( newBlend )
|
||||
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
|
||||
|
||||
// restore default GL state
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CGPoint v)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end, v))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CCX_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
return initWithColor(start, end, ccp(0, -1));
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CGPoint v)
|
||||
{
|
||||
m_endColor.r = end.r;
|
||||
m_endColor.g = end.g;
|
||||
m_endColor.b = end.b;
|
||||
|
||||
m_cEndOpacity = end.a;
|
||||
m_cStartOpacity = start.a;
|
||||
m_AlongVector = v;
|
||||
|
||||
start.a = 255;
|
||||
return this->initWithColor(start);
|
||||
}
|
||||
|
||||
void CCLayerGradient::updateColor()
|
||||
{
|
||||
CCLayerColor::updateColor();
|
||||
|
||||
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
||||
if (h == 0)
|
||||
return;
|
||||
|
||||
double c = sqrt(2);
|
||||
CGPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
||||
|
||||
float opacityf = (float)m_cOpacity / 255.0f;
|
||||
|
||||
ccColor4B S = {
|
||||
m_tColor.r,
|
||||
m_tColor.g,
|
||||
m_tColor.b,
|
||||
m_cStartOpacity * opacityf
|
||||
};
|
||||
|
||||
ccColor4B E = {
|
||||
m_endColor.r,
|
||||
m_endColor.g,
|
||||
m_endColor.b,
|
||||
m_cEndOpacity * opacityf
|
||||
};
|
||||
|
||||
// (-1, -1)
|
||||
m_pSquareColors[0] = E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[1] = E.g + (S.g - E.g) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[2] = E.b + (S.b - E.b) * ((c + u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[3] = E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c));
|
||||
// (1, -1)
|
||||
m_pSquareColors[4] = E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[5] = E.g + (S.g - E.g) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[6] = E.b + (S.b - E.b) * ((c - u.x + u.y) / (2.0f * c));
|
||||
m_pSquareColors[7] = E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c));
|
||||
// (-1, 1)
|
||||
m_pSquareColors[8] = E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[9] = E.g + (S.g - E.g) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[10] = E.b + (S.b - E.b) * ((c + u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[11] = E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c));
|
||||
// (1, 1)
|
||||
m_pSquareColors[12] = E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[13] = E.g + (S.g - E.g) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[14] = E.b + (S.b - E.b) * ((c - u.x - u.y) / (2.0f * c));
|
||||
m_pSquareColors[15] = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c));
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getStartColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartColor(ccColor3B colors)
|
||||
{
|
||||
setColor(colors);
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndColor(ccColor3B colors)
|
||||
{
|
||||
m_endColor = colors;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getEndColor()
|
||||
{
|
||||
return m_endColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartOpacity(GLubyte o)
|
||||
{
|
||||
m_cStartOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getStartOpacity()
|
||||
{
|
||||
return m_cStartOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndOpacity(GLubyte o)
|
||||
{
|
||||
m_cEndOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getEndOpacity()
|
||||
{
|
||||
return m_cEndOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setAlongVector(CGPoint var)
|
||||
{
|
||||
m_AlongVector = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
CGPoint CCLayerGradient::getAlongVector()
|
||||
{
|
||||
return m_AlongVector;
|
||||
}
|
||||
|
||||
/// MultiplexLayer
|
||||
|
||||
CCMultiplexLayer::CCMultiplexLayer()
|
||||
{
|
||||
}
|
||||
CCMultiplexLayer::~CCMultiplexLayer()
|
||||
{
|
||||
m_pLayers->release();
|
||||
}
|
||||
|
||||
CCMultiplexLayer * CCMultiplexLayer::layerWithLayers(CCLayer * layer, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,layer);
|
||||
|
||||
CCMultiplexLayer * pMultiplexLayer = new CCMultiplexLayer();
|
||||
if(pMultiplexLayer && pMultiplexLayer->initWithLayers(layer, args))
|
||||
{
|
||||
pMultiplexLayer->autorelease();
|
||||
va_end(args);
|
||||
return pMultiplexLayer;
|
||||
}
|
||||
va_end(args);
|
||||
CCX_SAFE_DELETE(pMultiplexLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMultiplexLayer::initWithLayers(CCLayer *layer, va_list params)
|
||||
{
|
||||
m_pLayers = new NSMutableArray<CCLayer*>(5);
|
||||
//m_pLayers->retain();
|
||||
|
||||
m_pLayers->addObject(layer);
|
||||
|
||||
CCLayer *l = va_arg(params,CCLayer*);
|
||||
while( l ) {
|
||||
m_pLayers->addObject(l);
|
||||
l = va_arg(params,CCLayer*);
|
||||
}
|
||||
|
||||
m_nEnabledLayer = 0;
|
||||
this->addChild(m_pLayers->getObjectAtIndex(m_nEnabledLayer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CCMultiplexLayer::switchTo(unsigned int n)
|
||||
{
|
||||
NSAssert( n < m_pLayers->count(), "Invalid index in MultiplexLayer switchTo message" );
|
||||
|
||||
this->removeChild(m_pLayers->getObjectAtIndex(m_nEnabledLayer), true);
|
||||
|
||||
m_nEnabledLayer = n;
|
||||
|
||||
this->addChild(m_pLayers->getObjectAtIndex(n));
|
||||
}
|
||||
|
||||
void CCMultiplexLayer::switchToAndReleaseMe(unsigned int n)
|
||||
{
|
||||
NSAssert( n < m_pLayers->count(), "Invalid index in MultiplexLayer switchTo message" );
|
||||
|
||||
this->removeChild(m_pLayers->getObjectAtIndex(m_nEnabledLayer), true);
|
||||
|
||||
//[layers replaceObjectAtIndex:enabledLayer withObject:[NSNull null]];
|
||||
m_pLayers->replaceObjectAtIndex(m_nEnabledLayer, NULL);
|
||||
|
||||
m_nEnabledLayer = n;
|
||||
|
||||
this->addChild(m_pLayers->getObjectAtIndex(n));
|
||||
}
|
||||
}//namespace cocos2d
|
|
@ -0,0 +1,627 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
#include "CCMenu.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCXApplication.h"
|
||||
#include "CGPointExtension.h"
|
||||
#include "CCTouchDispatcher.h"
|
||||
#include "CCTouch.h"
|
||||
#include "platform/CCXMath.h"
|
||||
|
||||
#include <vector>
|
||||
#include <float.h>
|
||||
using namespace std;
|
||||
|
||||
namespace cocos2d{
|
||||
|
||||
enum
|
||||
{
|
||||
kDefaultPadding = 5,
|
||||
};
|
||||
|
||||
//
|
||||
//CCMenu
|
||||
//
|
||||
CCMenu * CCMenu::menuWithItems(CCMenuItem* item, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,item);
|
||||
CCMenu *pRet = new CCMenu();
|
||||
if (pRet && pRet->initWithItems(item, args))
|
||||
{
|
||||
pRet->autorelease();
|
||||
va_end(args);
|
||||
return pRet;
|
||||
}
|
||||
va_end(args);
|
||||
CCX_SAFE_DELETE(pRet)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMenu::initWithItems(CCMenuItem* item, va_list args)
|
||||
{
|
||||
if (CCLayer::init())
|
||||
{
|
||||
this->m_bIsMouseEnabled = true;
|
||||
|
||||
// menu in the center of the screen
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
this->m_bIsRelativeAnchorPoint = false;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
this->setContentSize(s);
|
||||
|
||||
// XXX: in v0.7, winSize should return the visible size
|
||||
// XXX: so the bar calculation should be done there
|
||||
this->m_tPosition = ccp(s.width/2, s.height/2);
|
||||
|
||||
int z=0;
|
||||
|
||||
if (item)
|
||||
{
|
||||
this->addChild(item, z);
|
||||
CCMenuItem *i = va_arg(args, CCMenuItem*);
|
||||
while (i)
|
||||
{
|
||||
z++;
|
||||
this->addChild(i, z);
|
||||
i = va_arg(args, CCMenuItem*);
|
||||
}
|
||||
}
|
||||
// [self alignItemsVertically];
|
||||
|
||||
m_pSelectedItem = NULL;
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* override add:
|
||||
*/
|
||||
CCNode * CCMenu::addChild(CCNode * child, int zOrder)
|
||||
{
|
||||
return CCLayer::addChild(child, zOrder);
|
||||
}
|
||||
|
||||
CCNode * CCMenu::addChild(CCNode * child, int zOrder, int tag)
|
||||
{
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
/*NSAssert( dynamic_cast<CCMenuItem*>(child) != NULL, L"Menu only supports MenuItem objects as children");*/
|
||||
return CCLayer::addChild(child, zOrder, tag);
|
||||
}
|
||||
|
||||
void CCMenu::onExit()
|
||||
{
|
||||
if (m_eState == kCCMenuStateTrackingTouch)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
m_pSelectedItem = NULL;
|
||||
}
|
||||
|
||||
CCLayer::onExit();
|
||||
}
|
||||
|
||||
void CCMenu::registerWithTouchDispatcher()
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
}
|
||||
|
||||
CCMenuItem* CCMenu::itemForTouch(CCTouch * touch)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMenu::ccTouchBegan(CCTouch* touch, UIEvent* event)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
void CCMenu::ccTouchEnded(CCTouch* touch, UIEvent* event)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
}
|
||||
|
||||
void CCMenu::ccTouchCancelled(CCTouch *touch, UIEvent* event)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
}
|
||||
|
||||
void CCMenu::ccTouchMoved(CCTouch* touch, UIEvent* event)
|
||||
{
|
||||
CCLOG("cocos2d: CCMenu: unsupported");
|
||||
}
|
||||
|
||||
//Menu - Events
|
||||
int CCMenu::mouseDelegatePriority()
|
||||
{
|
||||
return -1;/** @todo upto-0.99.5 use NSIntegerMin+1 instead*/
|
||||
}
|
||||
|
||||
CCMenuItem* CCMenu::itemForMouseEvent(NSEvent * pEvent)
|
||||
{
|
||||
CGPoint touchLocation = CCDirector::sharedDirector()->convertEventToGL(pEvent);
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ((*it)->getIsVisible() && ((CCMenuItem*)(*it))->getIsEnabled())
|
||||
{
|
||||
CGPoint local = (*it)->convertToNodeSpace(touchLocation);
|
||||
|
||||
CGRect r = ((CCMenuItem*)(*it))->rect();
|
||||
r.origin = CGPointZero;
|
||||
|
||||
if (CGRect::CGRectContainsPoint(r, local))
|
||||
{
|
||||
return (CCMenuItem*)(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseUp(NSEvent * pEvent)
|
||||
{
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
m_pSelectedItem->activate();
|
||||
|
||||
m_eState = kCCMenuStateWaiting;
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseDown(NSEvent * pEvent)
|
||||
{
|
||||
if (! getIsVisible())
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
m_pSelectedItem = itemForMouseEvent(pEvent);
|
||||
m_pSelectedItem->selected();
|
||||
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_eState = kCCMenuStateTrackingTouch;
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
bool CCMenu::ccMouseDragged(NSEvent * pEvent)
|
||||
{
|
||||
CCMenuItem* currentItem = itemForMouseEvent(pEvent);
|
||||
|
||||
if (currentItem && currentItem != m_pSelectedItem)
|
||||
{
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
m_pSelectedItem->unselected();
|
||||
}
|
||||
|
||||
m_pSelectedItem = currentItem;
|
||||
m_pSelectedItem->selected();
|
||||
}
|
||||
|
||||
if (currentItem && m_eState == kCCMenuStateTrackingTouch)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
void CCMenu::destroy(void)
|
||||
{
|
||||
release();
|
||||
}
|
||||
|
||||
void CCMenu::keep(void)
|
||||
{
|
||||
retain();
|
||||
}
|
||||
|
||||
//Menu - Alignment
|
||||
void CCMenu::alignItemsVertically()
|
||||
{
|
||||
return this->alignItemsVerticallyWithPadding(kDefaultPadding);
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsVerticallyWithPadding(float padding)
|
||||
{
|
||||
float height = -padding;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
height += (*it)->getContentSize().height * (*it)->getScaleY() + padding;
|
||||
}
|
||||
}
|
||||
|
||||
float y = height / 2.0f;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(*it)->setPosition(ccp(0, y - (*it)->getContentSize().height * (*it)->getScaleY() / 2.0f));
|
||||
y -= (*it)->getContentSize().height * (*it)->getScaleY() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsHorizontally(void)
|
||||
{
|
||||
return this->alignItemsHorizontallyWithPadding(kDefaultPadding);
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsHorizontallyWithPadding(float padding)
|
||||
{
|
||||
|
||||
float width = -padding;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
width += (*it)->getContentSize().width * (*it)->getScaleX() + padding;
|
||||
}
|
||||
}
|
||||
|
||||
float x = -width / 2.0f;
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(*it)->setPosition(ccp(x + (*it)->getContentSize().width * (*it)->getScaleX() / 2.0f, 0));
|
||||
x += (*it)->getContentSize().width * (*it)->getScaleX() + padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsInColumns(unsigned int columns, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, columns);
|
||||
|
||||
this->alignItemsInColumns(columns, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsInColumns(unsigned int columns, va_list args)
|
||||
{
|
||||
vector<unsigned int> rows;
|
||||
while (columns)
|
||||
{
|
||||
rows.push_back(columns);
|
||||
columns = va_arg(args, unsigned int);
|
||||
}
|
||||
|
||||
int height = -5;
|
||||
unsigned int row = 0;
|
||||
unsigned int rowHeight = 0;
|
||||
unsigned int columnsOccupied = 0;
|
||||
unsigned int rowColumns;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
// if it has no value, break
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
assert(row < rows.size());
|
||||
|
||||
rowColumns = rows[row];
|
||||
// can not have zero columns on a row
|
||||
assert(rowColumns);
|
||||
|
||||
float tmp = (*it)->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp);
|
||||
|
||||
++columnsOccupied;
|
||||
if (columnsOccupied >= rowColumns)
|
||||
{
|
||||
height += rowHeight + 5;
|
||||
|
||||
columnsOccupied = 0;
|
||||
rowHeight = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if too many rows/columns for available menu items
|
||||
assert(! columnsOccupied);
|
||||
|
||||
CGSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
row = 0;
|
||||
rowHeight = 0;
|
||||
rowColumns = 0;
|
||||
float w;
|
||||
float x;
|
||||
float y = (float)(height / 2);
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (rowColumns == 0)
|
||||
{
|
||||
rowColumns = rows[row];
|
||||
w = winSize.width / (1 + rowColumns);
|
||||
x = w;
|
||||
}
|
||||
|
||||
float tmp = (*it)->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp);
|
||||
|
||||
(*it)->setPosition(ccp(x - winSize.width / 2,
|
||||
y - (*it)->getContentSize().height / 2));
|
||||
|
||||
x += w + 10;
|
||||
++columnsOccupied;
|
||||
|
||||
if (columnsOccupied >= rowColumns)
|
||||
{
|
||||
y -= rowHeight + 5;
|
||||
|
||||
columnsOccupied = 0;
|
||||
rowColumns = 0;
|
||||
rowHeight = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsInRows(unsigned int rows, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, rows);
|
||||
|
||||
this->alignItemsInColumns(rows, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void CCMenu::alignItemsInRows(unsigned int rows, va_list args)
|
||||
{
|
||||
vector<unsigned int> columns;
|
||||
while (rows)
|
||||
{
|
||||
columns.push_back(rows);
|
||||
rows = va_arg(args, unsigned int);
|
||||
}
|
||||
|
||||
vector<unsigned int> columnWidths;
|
||||
vector<unsigned int> columnHeights;
|
||||
|
||||
int width = -10;
|
||||
int columnHeight = -5;
|
||||
unsigned int column = 0;
|
||||
unsigned int columnWidth = 0;
|
||||
unsigned int rowsOccupied = 0;
|
||||
unsigned int columnRows;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// check if too many menu items for the amount of rows/columns
|
||||
assert(column < columns.size());
|
||||
|
||||
columnRows = columns[column];
|
||||
// can't have zero rows on a column
|
||||
assert(columnRows);
|
||||
|
||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||
float tmp = (*it)->getContentSize().width;
|
||||
columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp);
|
||||
|
||||
columnHeight += (int)((*it)->getContentSize().height + 5);
|
||||
++rowsOccupied;
|
||||
|
||||
if (rowsOccupied >= columnRows)
|
||||
{
|
||||
columnWidths.push_back(columnWidth);
|
||||
columnHeights.push_back(columnHeight);
|
||||
width += columnWidth + 10;
|
||||
|
||||
rowsOccupied = 0;
|
||||
columnWidth = 0;
|
||||
columnHeight = -5;
|
||||
++column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if too many rows/columns for available menu items.
|
||||
assert(! rowsOccupied);
|
||||
|
||||
CGSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
column = 0;
|
||||
columnWidth = 0;
|
||||
columnRows = 0;
|
||||
float x = (float)(-width / 2);
|
||||
float y;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (columnRows == 0)
|
||||
{
|
||||
columnRows = columns[column];
|
||||
y = (float) columnHeights[column];
|
||||
}
|
||||
|
||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||
float tmp = (*it)->getContentSize().width;
|
||||
columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp);
|
||||
|
||||
(*it)->setPosition(ccp(x + columnWidths[column] / 2,
|
||||
y - winSize.height / 2));
|
||||
|
||||
y -= (*it)->getContentSize().height + 10;
|
||||
++rowsOccupied;
|
||||
|
||||
if (rowsOccupied >= columnRows)
|
||||
{
|
||||
x += columnWidth + 5;
|
||||
rowsOccupied = 0;
|
||||
columnRows = 0;
|
||||
columnWidth = 0;
|
||||
++column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Opacity Protocol
|
||||
|
||||
/** Override synthesized setOpacity to recurse items */
|
||||
void CCMenu::setOpacity(GLubyte var)
|
||||
{
|
||||
m_cOpacity = var;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setOpacity(m_cOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLubyte CCMenu::getOpacity(void)
|
||||
{
|
||||
return m_cOpacity;
|
||||
}
|
||||
|
||||
void CCMenu::setColor(cocos2d::ccColor3B var)
|
||||
{
|
||||
m_tColor = var;
|
||||
|
||||
if (m_pChildren && m_pChildren->count() > 0)
|
||||
{
|
||||
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
|
||||
for (it = m_pChildren->begin(); it != m_pChildren->end(); ++it)
|
||||
{
|
||||
if (! *it)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CCRGBAProtocol *pRGBAProtocol = (*it)->convertToRGBAProtocol();
|
||||
if (pRGBAProtocol)
|
||||
{
|
||||
pRGBAProtocol->setColor(m_tColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccColor3B CCMenu::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -372,10 +372,6 @@
|
|||
RelativePath="..\include\CCNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCPageTurnTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCParallaxNode.h"
|
||||
>
|
||||
|
@ -404,10 +400,6 @@
|
|||
RelativePath="..\include\CCQuadParticleSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCRadialTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCRenderTexture.h"
|
||||
>
|
||||
|
@ -488,6 +480,14 @@
|
|||
RelativePath="..\include\CCTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCTransitionPageTurn.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCTransitionRadial.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\ccTypes.h"
|
||||
>
|
||||
|
@ -592,34 +592,22 @@
|
|||
<Filter
|
||||
Name="layers_scenes_transition_nodes"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCLayer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCPageTurnTransition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCRadialTransition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCScene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransition.cpp"
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransitionPageTurn.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransitionRadial.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="menu_nodes"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\menu_nodes\CCMenu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\menu_nodes\CCMenuItem.cpp"
|
||||
>
|
||||
|
@ -892,10 +880,22 @@
|
|||
RelativePath="..\platform\CCFileUtils_platform.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCLayer_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCMenu_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCNode_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCTransition_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCXApplication_platform.h"
|
||||
>
|
||||
|
|
|
@ -186,10 +186,6 @@
|
|||
RelativePath="..\base_nodes\CCAtlasNode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\base_nodes\CCNode.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="cocoa"
|
||||
|
@ -402,10 +398,6 @@
|
|||
RelativePath="..\include\CCNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCPageTurnTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCParallaxNode.h"
|
||||
>
|
||||
|
@ -438,10 +430,6 @@
|
|||
RelativePath="..\include\CCQuadParticleSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCRadialTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCRenderTexture.h"
|
||||
>
|
||||
|
@ -522,6 +510,14 @@
|
|||
RelativePath="..\include\CCTransition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCTransitionPageTurn.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\CCTransitionRadial.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\ccTypes.h"
|
||||
>
|
||||
|
@ -634,34 +630,22 @@
|
|||
<Filter
|
||||
Name="layers_scenes_transitions_nodes"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCLayer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCPageTurnTransition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCRadialTransition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCScene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransition.cpp"
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransitionPageTurn.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\layers_scenes_transitions_nodes\CCTransitionRadial.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="menu_nodes"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\menu_nodes\CCMenu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\menu_nodes\CCMenuItem.cpp"
|
||||
>
|
||||
|
@ -714,6 +698,22 @@
|
|||
RelativePath="..\platform\CCFileUtils_platform.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCLayer_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCMenu_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCNode_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCTransition_mobile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCXApplication_platform.h"
|
||||
>
|
||||
|
|
|
@ -348,7 +348,7 @@ Atlas3::Atlas3()
|
|||
{
|
||||
m_time = 0;
|
||||
|
||||
CCColorLayer* col = CCColorLayer::layerWithColor( ccc4(128,128,128,255) );
|
||||
CCLayerColor* col = CCLayerColor::layerWithColor( ccc4(128,128,128,255) );
|
||||
addChild(col, -10);
|
||||
|
||||
CCLabelBMFont* label1 = CCLabelBMFont::bitmapFontAtlasWithString("Test", "fonts/bitmapFontTest2.fnt");
|
||||
|
|
|
@ -21,7 +21,7 @@ MainLayer::MainLayer()
|
|||
|
||||
CCSprite* sprite = CCSprite::spriteWithFile(s_pPathGrossini);
|
||||
|
||||
CCLayer* layer = CCColorLayer::layerWithColor(ccc4(255,255,0,255));
|
||||
CCLayer* layer = CCLayerColor::layerWithColor(ccc4(255,255,0,255));
|
||||
addChild(layer, -1);
|
||||
|
||||
addChild(sprite, 0, kTagSprite);
|
||||
|
|
|
@ -199,14 +199,14 @@ void Issue631::onEnter()
|
|||
removeChild(bg, true);
|
||||
|
||||
// background
|
||||
CCColorLayer* layer = CCColorLayer::layerWithColor( ccc4(255,0,0,255) );
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4(255,0,0,255) );
|
||||
addChild(layer, -10);
|
||||
CCSprite* sprite = CCSprite::spriteWithFile("Images/grossini.png");
|
||||
sprite->setPosition( ccp(50,80) );
|
||||
layer->addChild(sprite, 10);
|
||||
|
||||
// foreground
|
||||
CCColorLayer* layer2 = CCColorLayer::layerWithColor(ccc4( 0, 255,0,255 ) );
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColor(ccc4( 0, 255,0,255 ) );
|
||||
CCSprite* fog = CCSprite::spriteWithFile("Images/Fog.png");
|
||||
|
||||
ccBlendFunc bf = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class TextLayer : public CCColorLayer
|
||||
class TextLayer : public CCLayerColor
|
||||
{
|
||||
protected:
|
||||
//UxString m_strTitle;
|
||||
|
|
|
@ -134,7 +134,7 @@ void LayerTest1::onEnter()
|
|||
setIsTouchEnabled(true);
|
||||
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCColorLayer* layer = CCColorLayer::layerWithColorWidthHeight( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
CCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
|
||||
|
||||
layer->setIsRelativeAnchorPoint(true);
|
||||
layer->setPosition( CGPointMake(s.width/2, s.height/2) );
|
||||
|
@ -155,7 +155,7 @@ void LayerTest1::updateSize(CCTouch*touch)
|
|||
|
||||
CGSize newSize = CGSizeMake( fabs(touchLocation.x - s.width/2)*2, fabs(touchLocation.y - s.height/2)*2);
|
||||
|
||||
CCColorLayer* l = (CCColorLayer*) getChildByTag(kTagLayer);
|
||||
CCLayerColor* l = (CCLayerColor*) getChildByTag(kTagLayer);
|
||||
|
||||
l->setContentSize( newSize );
|
||||
}
|
||||
|
@ -192,12 +192,12 @@ void LayerTest2::onEnter()
|
|||
LayerTest::onEnter();
|
||||
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCColorLayer* layer1 = CCColorLayer::layerWithColorWidthHeight( ccc4(255, 255, 0, 80), 100, 300);
|
||||
CCLayerColor* layer1 = CCLayerColor::layerWithColorWidthHeight( ccc4(255, 255, 0, 80), 100, 300);
|
||||
layer1->setPosition(CGPointMake(s.width/3, s.height/2));
|
||||
layer1->setIsRelativeAnchorPoint(true);
|
||||
addChild(layer1, 1);
|
||||
|
||||
CCColorLayer* layer2 = CCColorLayer::layerWithColorWidthHeight( ccc4(0, 0, 255, 255), 100, 300);
|
||||
CCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight( ccc4(0, 0, 255, 255), 100, 300);
|
||||
layer2->setPosition(CGPointMake((s.width/3)*2, s.height/2));
|
||||
layer2->setIsRelativeAnchorPoint(true);
|
||||
addChild(layer2, 1);
|
||||
|
@ -227,7 +227,7 @@ std::string LayerTest2::title()
|
|||
LayerTestBlend::LayerTestBlend()
|
||||
{
|
||||
CGSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
CCColorLayer* layer1 = CCColorLayer::layerWithColor( ccc4(255, 255, 255, 80) );
|
||||
CCLayerColor* layer1 = CCLayerColor::layerWithColor( ccc4(255, 255, 255, 80) );
|
||||
|
||||
CCSprite* sister1 = CCSprite::spriteWithFile(s_pPathSister1);
|
||||
CCSprite* sister2 = CCSprite::spriteWithFile(s_pPathSister2);
|
||||
|
@ -244,7 +244,7 @@ LayerTestBlend::LayerTestBlend()
|
|||
|
||||
void LayerTestBlend::newBlend(ccTime dt)
|
||||
{
|
||||
CCColorLayer *layer = (CCColorLayer*)getChildByTag(kTagLayer);
|
||||
CCLayerColor *layer = (CCLayerColor*)getChildByTag(kTagLayer);
|
||||
|
||||
GLenum src;
|
||||
GLenum dst;
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class ParticleDemo : public CCColorLayer
|
||||
class ParticleDemo : public CCLayerColor
|
||||
{
|
||||
protected:
|
||||
CCParticleSystem* m_emitter;
|
||||
|
|
|
@ -90,10 +90,10 @@ void RotateWorldMainLayer::onEnter()
|
|||
x = size.width;
|
||||
y = size.height;
|
||||
|
||||
CCNode* blue = CCColorLayer::layerWithColor(ccc4(0,0,255,255));
|
||||
CCNode* red = CCColorLayer::layerWithColor(ccc4(255,0,0,255));
|
||||
CCNode* green = CCColorLayer::layerWithColor(ccc4(0,255,0,255));
|
||||
CCNode* white = CCColorLayer::layerWithColor(ccc4(255,255,255,255));
|
||||
CCNode* blue = CCLayerColor::layerWithColor(ccc4(0,0,255,255));
|
||||
CCNode* red = CCLayerColor::layerWithColor(ccc4(255,0,0,255));
|
||||
CCNode* green = CCLayerColor::layerWithColor(ccc4(0,255,0,255));
|
||||
CCNode* white = CCLayerColor::layerWithColor(ccc4(255,255,255,255));
|
||||
|
||||
blue->setScale(0.5f);
|
||||
blue->setPosition(CGPointMake(-x/4,-y/4));
|
||||
|
|
|
@ -64,7 +64,7 @@ void SceneTestLayer1::onPushSceneTran(NSObject* pSender)
|
|||
CCLayer* pLayer = new SceneTestLayer2();
|
||||
scene->addChild( pLayer, 0 );
|
||||
|
||||
CCDirector::sharedDirector()->pushScene( CCSlideInTTransition::transitionWithDuration(1, scene) );
|
||||
CCDirector::sharedDirector()->pushScene( CCTransitionSlideInT::transitionWithDuration(1, scene) );
|
||||
scene->release();
|
||||
pLayer->release();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void SceneTestLayer2::onReplaceSceneTran(NSObject* pSender)
|
|||
CCScene* pScene = new SceneTestScene();
|
||||
CCLayer* pLayer = new SceneTestLayer3();
|
||||
pScene->addChild( pLayer, 0 );
|
||||
CCDirector::sharedDirector()->replaceScene( CCFlipXTransition::transitionWithDuration(2, pScene) );
|
||||
CCDirector::sharedDirector()->replaceScene( CCTransitionFlipX::transitionWithDuration(2, pScene) );
|
||||
pScene->release();
|
||||
pLayer->release();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
//CREATE_NODE(SceneTestLayer2);
|
||||
} ;
|
||||
|
||||
class SceneTestLayer3 : public CCColorLayer
|
||||
class SceneTestLayer3 : public CCLayerColor
|
||||
{
|
||||
public:
|
||||
SceneTestLayer3();
|
||||
|
|
|
@ -108,7 +108,7 @@ TMXOrthoTest::TMXOrthoTest()
|
|||
//
|
||||
// it should not flicker. No artifacts should appear
|
||||
//
|
||||
//CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
//CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
//addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap* map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/orthogonal-test2.tmx");
|
||||
|
@ -428,7 +428,7 @@ std::string TMXReadWriteTest::title()
|
|||
//------------------------------------------------------------------
|
||||
TMXHexTest::TMXHexTest()
|
||||
{
|
||||
CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap* map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/hexa-test.tmx");
|
||||
|
@ -450,7 +450,7 @@ std::string TMXHexTest::title()
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoTest::TMXIsoTest()
|
||||
{
|
||||
CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap* map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test.tmx");
|
||||
|
@ -474,7 +474,7 @@ std::string TMXIsoTest::title()
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoTest1::TMXIsoTest1()
|
||||
{
|
||||
CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test1.tmx");
|
||||
|
@ -498,7 +498,7 @@ std::string TMXIsoTest1::title()
|
|||
//------------------------------------------------------------------
|
||||
TMXIsoTest2::TMXIsoTest2()
|
||||
{
|
||||
CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test2.tmx");
|
||||
|
@ -525,7 +525,7 @@ std::string TMXIsoTest2::title()
|
|||
//------------------------------------------------------------------
|
||||
TMXUncompressedTest::TMXUncompressedTest()
|
||||
{
|
||||
CCColorLayer* color = CCColorLayer::layerWithColor( ccc4(64,64,64,255) );
|
||||
CCLayerColor* color = CCLayerColor::layerWithColor( ccc4(64,64,64,255) );
|
||||
addChild(color, -1);
|
||||
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/iso-test2-uncompressed.tmx");
|
||||
|
|
|
@ -3,139 +3,139 @@
|
|||
|
||||
#define TRANSITION_DURATION (1.2f)
|
||||
|
||||
class FadeWhiteTransition : public CCFadeTransition
|
||||
class FadeWhiteTransition : public CCTransitionFade
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFadeTransition::transitionWithDuration(t, s, ccWHITE);
|
||||
return CCTransitionFade::transitionWithDuration(t, s, ccWHITE);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipXLeftOver : public CCFlipXTransition
|
||||
class FlipXLeftOver : public CCTransitionFlipX
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipXTransition::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
return CCTransitionFlipX::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipXRightOver : public CCFlipXTransition
|
||||
class FlipXRightOver : public CCTransitionFlipX
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipXTransition::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
return CCTransitionFlipX::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipYUpOver : public CCFlipYTransition
|
||||
class FlipYUpOver : public CCTransitionFlipY
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipYTransition::transitionWithDuration(t, s, kOrientationUpOver);
|
||||
return CCTransitionFlipY::transitionWithDuration(t, s, kOrientationUpOver);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipYDownOver : public CCFlipYTransition
|
||||
class FlipYDownOver : public CCTransitionFlipY
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipYTransition::transitionWithDuration(t, s, kOrientationDownOver);
|
||||
return CCTransitionFlipY::transitionWithDuration(t, s, kOrientationDownOver);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipAngularLeftOver : public CCFlipAngularTransition
|
||||
class FlipAngularLeftOver : public CCTransitionFlipAngular
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipAngularTransition::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
return CCTransitionFlipAngular::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
}
|
||||
};
|
||||
|
||||
class FlipAngularRightOver : public CCFlipAngularTransition
|
||||
class FlipAngularRightOver : public CCTransitionFlipAngular
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCFlipAngularTransition::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
return CCTransitionFlipAngular::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipXLeftOver : public CCZoomFlipXTransition
|
||||
class ZoomFlipXLeftOver : public CCTransitionZoomFlipX
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipXTransition::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
return CCTransitionZoomFlipX::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipXRightOver : public CCZoomFlipXTransition
|
||||
class ZoomFlipXRightOver : public CCTransitionZoomFlipX
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipXTransition::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
return CCTransitionZoomFlipX::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipYUpOver : public CCZoomFlipYTransition
|
||||
class ZoomFlipYUpOver : public CCTransitionZoomFlipY
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipYTransition::transitionWithDuration(t, s, kOrientationUpOver);
|
||||
return CCTransitionZoomFlipY::transitionWithDuration(t, s, kOrientationUpOver);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipYDownOver : public CCZoomFlipYTransition
|
||||
class ZoomFlipYDownOver : public CCTransitionZoomFlipY
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipYTransition::transitionWithDuration(t, s, kOrientationDownOver);
|
||||
return CCTransitionZoomFlipY::transitionWithDuration(t, s, kOrientationDownOver);
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipAngularLeftOver : public CCZoomFlipAngularTransition
|
||||
class ZoomFlipAngularLeftOver : public CCTransitionZoomFlipAngular
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipAngularTransition::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
return CCTransitionZoomFlipAngular::transitionWithDuration(t, s, kOrientationLeftOver);
|
||||
}
|
||||
};
|
||||
|
||||
class ZoomFlipAngularRightOver : public CCZoomFlipAngularTransition
|
||||
class ZoomFlipAngularRightOver : public CCTransitionZoomFlipAngular
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCZoomFlipAngularTransition::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
return CCTransitionZoomFlipAngular::transitionWithDuration(t, s, kOrientationRightOver);
|
||||
}
|
||||
};
|
||||
|
||||
class PageTransitionForward : public CCPageTurnTransition
|
||||
class PageTransitionForward : public CCTransitionPageTurn
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCPageTurnTransition::transitionWithDuration(t, s, false);
|
||||
return CCTransitionPageTurn::transitionWithDuration(t, s, false);
|
||||
}
|
||||
};
|
||||
|
||||
class PageTransitionBackward : public CCPageTurnTransition
|
||||
class PageTransitionBackward : public CCTransitionPageTurn
|
||||
{
|
||||
public:
|
||||
static CCTransitionScene* transitionWithDuration(ccTime t, CCScene* s)
|
||||
{
|
||||
return CCPageTurnTransition::transitionWithDuration(t, s, true);
|
||||
return CCTransitionPageTurn::transitionWithDuration(t, s, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -168,9 +168,9 @@ static std::string transitions[MAX_LAYER] = {
|
|||
"SlideInTTransition",
|
||||
"SlideInBTransition",
|
||||
|
||||
"CCCrossFadeTransition",
|
||||
"CCRadialCCWTransition",
|
||||
"CCRadialCWTransition",
|
||||
"CCTransitionCrossFade",
|
||||
"CCTransitionRadialCCW",
|
||||
"CCTransitionRadialCW",
|
||||
"PageTransitionForward",
|
||||
"PageTransitionBackward",
|
||||
"FadeTRTransition",
|
||||
|
@ -187,8 +187,8 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
{
|
||||
switch(nIndex)
|
||||
{
|
||||
case 0: return CCJumpZoomTransition::transitionWithDuration(t, s);
|
||||
case 1: return CCFadeTransition::transitionWithDuration(t, s);
|
||||
case 0: return CCTransitionJumpZoom::transitionWithDuration(t, s);
|
||||
case 1: return CCTransitionFade::transitionWithDuration(t, s);
|
||||
case 2: return FadeWhiteTransition::transitionWithDuration(t, s);
|
||||
case 3: return FlipXLeftOver::transitionWithDuration(t, s);
|
||||
case 4: return FlipXRightOver::transitionWithDuration(t, s);
|
||||
|
@ -202,29 +202,29 @@ CCTransitionScene* createTransition(int nIndex, ccTime t, CCScene* s)
|
|||
case 12: return ZoomFlipYDownOver::transitionWithDuration(t, s);
|
||||
case 13: return ZoomFlipAngularLeftOver::transitionWithDuration(t, s);
|
||||
case 14: return ZoomFlipAngularRightOver::transitionWithDuration(t, s);
|
||||
case 15: return CCShrinkGrowTransition::transitionWithDuration(t, s);
|
||||
case 16: return CCRotoZoomTransition::transitionWithDuration(t, s);
|
||||
case 17: return CCMoveInLTransition::transitionWithDuration(t, s);
|
||||
case 18: return CCMoveInRTransition::transitionWithDuration(t, s);
|
||||
case 19: return CCMoveInTTransition::transitionWithDuration(t, s);
|
||||
case 20: return CCMoveInBTransition::transitionWithDuration(t, s);
|
||||
case 21: return CCSlideInLTransition::transitionWithDuration(t, s);
|
||||
case 22: return CCSlideInRTransition::transitionWithDuration(t, s);
|
||||
case 23: return CCSlideInTTransition::transitionWithDuration(t, s);
|
||||
case 24: return CCSlideInBTransition::transitionWithDuration(t, s);
|
||||
case 15: return CCTransitionShrinkGrow::transitionWithDuration(t, s);
|
||||
case 16: return CCTransitionRotoZoom::transitionWithDuration(t, s);
|
||||
case 17: return CCTransitionMoveInL::transitionWithDuration(t, s);
|
||||
case 18: return CCTransitionMoveInR::transitionWithDuration(t, s);
|
||||
case 19: return CCTransitionMoveInT::transitionWithDuration(t, s);
|
||||
case 20: return CCTransitionMoveInB::transitionWithDuration(t, s);
|
||||
case 21: return CCTransitionSlideInL::transitionWithDuration(t, s);
|
||||
case 22: return CCTransitionSlideInR::transitionWithDuration(t, s);
|
||||
case 23: return CCTransitionSlideInT::transitionWithDuration(t, s);
|
||||
case 24: return CCTransitionSlideInB::transitionWithDuration(t, s);
|
||||
|
||||
case 25: return CCCrossFadeTransition::transitionWithDuration(t,s);
|
||||
case 26: return CCRadialCCWTransition::transitionWithDuration(t,s);
|
||||
case 27: return CCRadialCWTransition::transitionWithDuration(t,s);
|
||||
case 25: return CCTransitionCrossFade::transitionWithDuration(t,s);
|
||||
case 26: return CCTransitionRadialCCW::transitionWithDuration(t,s);
|
||||
case 27: return CCTransitionRadialCW::transitionWithDuration(t,s);
|
||||
case 28: return PageTransitionForward::transitionWithDuration(t, s);
|
||||
case 29: return PageTransitionBackward::transitionWithDuration(t, s);
|
||||
case 30: return CCFadeTRTransition::transitionWithDuration(t, s);
|
||||
case 31: return CCFadeBLTransition::transitionWithDuration(t, s);
|
||||
case 32: return CCFadeUpTransition::transitionWithDuration(t, s);
|
||||
case 33: return CCFadeDownTransition::transitionWithDuration(t, s);
|
||||
case 34: return CCTurnOffTilesTransition::transitionWithDuration(t, s);
|
||||
case 35: return CCSplitRowsTransition::transitionWithDuration(t, s);
|
||||
case 36: return CCSplitColsTransition::transitionWithDuration(t, s);
|
||||
case 30: return CCTransitionFadeTR::transitionWithDuration(t, s);
|
||||
case 31: return CCTransitionFadeBL::transitionWithDuration(t, s);
|
||||
case 32: return CCTransitionFadeUp::transitionWithDuration(t, s);
|
||||
case 33: return CCTransitionFadeDown::transitionWithDuration(t, s);
|
||||
case 34: return CCTransitionTurnOffTiles::transitionWithDuration(t, s);
|
||||
case 35: return CCTransitionSplitRows::transitionWithDuration(t, s);
|
||||
case 36: return CCTransitionSplitCols::transitionWithDuration(t, s);
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue