mirror of https://github.com/axmolengine/axmol.git
377 lines
10 KiB
Plaintext
377 lines
10 KiB
Plaintext
|
|
#include "CCNode.h"
|
|
#include "CCAction.h"
|
|
#include "CCProtocols.h"
|
|
#include "CCSpriteFrame.h"
|
|
#include "CCAnimation.h"
|
|
|
|
namespace cocos2d {
|
|
|
|
class CCActionInterval : public CCFiniteTimeAction
|
|
{
|
|
|
|
ccTime getElapsed(void);
|
|
bool initWithDuration(ccTime d);
|
|
bool isDone(void);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void step(ccTime dt);
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCActionInterval* reverse(void);
|
|
static CCActionInterval* actionWithDuration(ccTime d);
|
|
void setAmplitudeRate(CGFloat amp);
|
|
CGFloat getAmplitudeRate(void);
|
|
};
|
|
|
|
class CCSequence : public CCActionInterval
|
|
{
|
|
|
|
|
|
bool initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void stop(void);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
// static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
|
|
//ÓÃÒÔÏ·½·¨Ìæ´ú
|
|
static CCSequence* actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
|
|
/** helper contructor to create an array of sequenceable actions given an array */
|
|
static CCFiniteTimeAction* actionsWithArray(CCArray *actions);
|
|
};
|
|
|
|
|
|
class CCRepeat : public CCActionInterval
|
|
{
|
|
|
|
|
|
|
|
bool initWithAction(CCFiniteTimeAction *pAction, unsigned int times);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void stop(void);
|
|
void update(ccTime time);
|
|
bool isDone(void);
|
|
CCActionInterval* reverse(void);
|
|
|
|
void setInnerAction(CCFiniteTimeAction *pAction);
|
|
CCFiniteTimeAction* getInnerAction();
|
|
|
|
static CCRepeat* actionWithAction(CCFiniteTimeAction *pAction, unsigned int times);
|
|
|
|
};
|
|
|
|
|
|
class CCRepeatForever : public CCActionInterval
|
|
{
|
|
|
|
CCRepeatForever();
|
|
|
|
bool initWithAction(CCActionInterval *pAction);
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
void startWithTarget(CCNode* pTarget);
|
|
void step(ccTime dt);
|
|
bool isDone(void);
|
|
CCActionInterval* reverse(void);
|
|
|
|
void setInnerAction(CCActionInterval *pAction);
|
|
CCActionInterval* getInnerAction();
|
|
|
|
static CCRepeatForever* actionWithAction(CCActionInterval *pAction);
|
|
|
|
};
|
|
|
|
/** @brief Spawn a new action immediately
|
|
*/
|
|
class CCSpawn : public CCActionInterval
|
|
{
|
|
bool initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void stop(void);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
//static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
|
|
//ÓÃÒÔÏ·½·¨Ìæ´ú
|
|
static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
|
|
|
|
/** helper contructor to create an array of spawned actions given an array */
|
|
static CCFiniteTimeAction* actionsWithArray(CCArray *actions);
|
|
|
|
};
|
|
|
|
class CCRotateTo : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, float fDeltaAngle);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
static CCRotateTo* actionWithDuration(ccTime duration, float fDeltaAngle);
|
|
};
|
|
|
|
/** @brief Rotates a CCNode object clockwise a number of degrees by modifying it's rotation attribute.
|
|
*/
|
|
class CCRotateBy : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, float fDeltaAngle);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
static CCRotateBy* actionWithDuration(ccTime duration, float fDeltaAngle);
|
|
|
|
};
|
|
|
|
/** @brief Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
|
|
*/
|
|
class CCMoveTo : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, CCPoint position);
|
|
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
|
|
static CCMoveTo* actionWithDuration(ccTime duration, CCPoint position);
|
|
|
|
};
|
|
|
|
|
|
class CCMoveBy : public CCMoveTo
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, CCPoint position);
|
|
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCActionInterval* reverse(void);
|
|
static CCMoveBy* actionWithDuration(ccTime duration, CCPoint position);
|
|
};
|
|
|
|
class CC_DLL CCSkewTo : public CCActionInterval
|
|
{
|
|
CCSkewTo();
|
|
virtual bool initWithDuration(ccTime t, float sx, float sy);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual void update(ccTime time);
|
|
static CCSkewTo* actionWithDuration(ccTime t, float sx, float sy);
|
|
};
|
|
|
|
class CC_DLL CCSkewBy : public CCSkewTo
|
|
{
|
|
virtual bool initWithDuration(ccTime t, float sx, float sy);
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual CCActionInterval* reverse(void);
|
|
static CCSkewBy* actionWithDuration(ccTime t, float deltaSkewX, float deltaSkewY);
|
|
};
|
|
|
|
class CCJumpBy : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
static CCJumpBy* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
|
|
};
|
|
|
|
|
|
class CCJumpTo : public CCJumpBy
|
|
{
|
|
public:
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
static CCJumpTo* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
|
|
};
|
|
|
|
typedef struct _ccBezierConfig {
|
|
//! end position of the bezier
|
|
CCPoint endPosition;
|
|
//! Bezier control point 1
|
|
CCPoint controlPoint_1;
|
|
//! Bezier control point 2
|
|
CCPoint controlPoint_2;
|
|
} ccBezierConfig;
|
|
|
|
|
|
class CCBezierBy : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime t, ccBezierConfig c);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual void update(ccTime time);
|
|
virtual CCActionInterval* reverse(void);
|
|
|
|
|
|
static CCBezierBy* actionWithDuration(ccTime t, ccBezierConfig c);
|
|
|
|
};
|
|
|
|
|
|
class CCBezierTo : public CCBezierBy
|
|
{
|
|
public:
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
static CCBezierTo* actionWithDuration(ccTime t, ccBezierConfig c);
|
|
};
|
|
|
|
|
|
class CCScaleTo : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, float s);
|
|
bool initWithDuration(ccTime duration, float sx, float sy);
|
|
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
static CCScaleTo* actionWithDuration(ccTime duration, float s);
|
|
static CCScaleTo* actionWithDuration(ccTime duration, float sx, float sy);
|
|
};
|
|
|
|
|
|
class CCScaleBy : public CCScaleTo
|
|
{
|
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual CCActionInterval* reverse(void);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
|
|
static CCScaleBy* actionWithDuration(ccTime duration, float s);
|
|
static CCScaleBy* actionWithDuration(ccTime duration, float sx, float sy);
|
|
};
|
|
|
|
|
|
class CCBlink : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, unsigned int uBlinks);
|
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
virtual void update(ccTime time);
|
|
virtual CCActionInterval* reverse(void);
|
|
static CCBlink* actionWithDuration(ccTime duration, unsigned int uBlinks);
|
|
|
|
};
|
|
|
|
class CCFadeIn : public CCActionInterval
|
|
{
|
|
|
|
virtual void update(ccTime time);
|
|
virtual CCActionInterval* reverse(void);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
static CCFadeIn* actionWithDuration(ccTime d);
|
|
};
|
|
|
|
class CCFadeOut : public CCActionInterval
|
|
{
|
|
|
|
virtual void update(ccTime time);
|
|
virtual CCActionInterval* reverse(void);
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
static CCFadeOut* actionWithDuration(ccTime d);
|
|
};
|
|
|
|
|
|
class CCFadeTo : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, GLubyte opacity);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
static CCFadeTo* actionWithDuration(ccTime duration, GLubyte opacity);
|
|
};
|
|
|
|
|
|
class CCTintTo : public CCActionInterval
|
|
{
|
|
bool initWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
static CCTintTo* actionWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue);
|
|
};
|
|
|
|
class CCTintBy : public CCActionInterval
|
|
{
|
|
|
|
bool initWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
|
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
|
|
static CCTintBy* actionWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
|
|
|
};
|
|
|
|
/** @brief Delays the action a certain amount of seconds
|
|
*/
|
|
class CCDelayTime : public CCActionInterval
|
|
{
|
|
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
static CCDelayTime* actionWithDuration(ccTime d);
|
|
};
|
|
|
|
|
|
class CCReverseTime : public CCActionInterval
|
|
{
|
|
|
|
|
|
|
|
bool initWithAction(CCFiniteTimeAction *pAction);
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void stop(void);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
|
|
static CCReverseTime* actionWithAction(CCFiniteTimeAction *pAction);
|
|
|
|
};
|
|
|
|
class CCTexture2D;
|
|
|
|
class CCAnimate : public CCActionInterval
|
|
{
|
|
|
|
|
|
|
|
CCAnimation* getAnimation(void);
|
|
void setAnimation(CCAnimation *pAnimation);
|
|
bool initWithAnimation(CCAnimation *pAnimation);
|
|
bool initWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
|
|
|
|
|
bool initWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
|
|
|
CCObject* copyWithZone(CCZone* pZone);
|
|
void startWithTarget(CCNode *pTarget);
|
|
void stop(void);
|
|
void update(ccTime time);
|
|
CCActionInterval* reverse(void);
|
|
|
|
|
|
static CCAnimate* actionWithAnimation(CCAnimation *pAnimation);
|
|
|
|
static CCAnimate* actionWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
|
|
|
|
|
static CCAnimate* actionWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
|
|
|
};
|
|
|
|
}
|
|
|