mirror of https://github.com/axmolengine/axmol.git
* update tolua++ packages
This commit is contained in:
parent
1dd0330351
commit
712541d0ef
|
@ -1,2 +0,0 @@
|
||||||
#include "platform/CCAccelerometer_platform.h"
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
|
|
||||||
#include "CCCommon.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
double z;
|
|
||||||
double timestamp;
|
|
||||||
} CCAcceleration;
|
|
||||||
|
|
||||||
|
|
||||||
class CCAccelerometerDelegate
|
|
||||||
{
|
|
||||||
|
|
||||||
void didAccelerate(CCAcceleration* pAccelerationValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
} //namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,99 +1,232 @@
|
||||||
#include "ccTypes.h"
|
|
||||||
#include "CCObject.h"
|
|
||||||
#include "CCZone.h"
|
|
||||||
#include "CCNode.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
enum {
|
||||||
|
kCCActionTagInvalid = -1,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
class CCAction : public CCObject
|
||||||
kCCActionTagInvalid = -1,
|
{
|
||||||
};
|
// bool isDone(void);
|
||||||
|
// CCNode* getTarget(void);
|
||||||
|
// void setTarget(CCNode *pTarget);
|
||||||
|
// CCNode* getOriginalTarget(void);
|
||||||
|
// void setOriginalTarget(CCNode *pOriginalTarget);
|
||||||
|
// int getTag(void);
|
||||||
|
// void setTag(int nTag);
|
||||||
|
|
||||||
class CCAction : public CCObject
|
// static CCAction* action();
|
||||||
{
|
};
|
||||||
|
|
||||||
CCAction(void);
|
|
||||||
char * description();
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
bool isDone(void);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
void stop(void);
|
|
||||||
void step(ccTime dt);
|
|
||||||
void update(ccTime time);
|
|
||||||
CCNode* getTarget(void);
|
|
||||||
void setTarget(CCNode *pTarget);
|
|
||||||
CCNode* getOriginalTarget(void);
|
|
||||||
|
|
||||||
void setOriginalTarget(CCNode *pOriginalTarget);
|
class CCActionInterval : public CCAction
|
||||||
int getTag(void);
|
{
|
||||||
void setTag(int nTag);
|
// ccTime getElapsed(void);
|
||||||
static CCAction* action();
|
// void setAmplitudeRate(CGFloat amp);
|
||||||
|
// CGFloat getAmplitudeRate(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CCFiniteTimeAction : public CCActionInterval
|
||||||
|
{
|
||||||
|
// ccTime getDuration(void);
|
||||||
|
// void setDuration(ccTime duration);
|
||||||
|
// CCFiniteTimeAction* reverse(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
// CCActionInterval
|
||||||
|
class CCSpeed : public CCAction
|
||||||
|
{
|
||||||
|
float getSpeed(void);
|
||||||
|
void setSpeed(float fSpeed);
|
||||||
|
CCAction* reverse(void);
|
||||||
|
|
||||||
|
static CCSpeed* actionWithAction(CCActionInterval *pAction, float fRate);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFollow : public CCAction
|
||||||
|
{
|
||||||
|
bool isBoundarySet(void);
|
||||||
|
void setBoudarySet(bool bValue);
|
||||||
|
|
||||||
|
static CCFollow* actionWithTarget(CCNode *pFollowedNode);
|
||||||
|
static CCFollow* actionWithTarget(CCNode *pFollowedNode, CCRect rect);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCSequence : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCFiniteTimeAction* actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
|
||||||
|
static CCFiniteTimeAction* actionsWithArray(CCArray *actions);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCRepeat : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCRepeat* actionWithAction(CCActionInterval *pAction, unsigned int times);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCRepeatForever : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCRepeatForever* actionWithAction(CCActionInterval *pAction);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCSpawn : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCFiniteTimeAction* actionsWithArray(CCArray *actions);
|
||||||
|
static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCRotateTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCRotateTo* actionWithDuration(ccTime duration, float fDeltaAngle);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCRotateBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCRotateBy* actionWithDuration(ccTime duration, float fDeltaAngle);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCMoveTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCMoveTo* actionWithDuration(ccTime duration, CCPoint position);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCMoveBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCMoveBy* actionWithDuration(ccTime duration, CCPoint position);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCSkewTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCSkewTo* actionWithDuration(ccTime t, float sx, float sy);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCSkewBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCSkewBy* actionWithDuration(ccTime t, float deltaSkewX, float deltaSkewY);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCJumpBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCJumpBy* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCJumpTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCJumpTo* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _ccBezierConfig {
|
||||||
|
CCPoint endPosition;
|
||||||
|
CCPoint controlPoint_1;
|
||||||
|
CCPoint controlPoint_2;
|
||||||
|
} ccBezierConfig;
|
||||||
|
|
||||||
|
class CCBezierBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCBezierBy* actionWithDuration(ccTime t, ccBezierConfig c);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCBezierTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCBezierTo* actionWithDuration(ccTime t, ccBezierConfig c);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCScaleTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCScaleTo* actionWithDuration(ccTime duration, float s);
|
||||||
|
static CCScaleTo* actionWithDuration(ccTime duration, float sx, float sy);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCScaleBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCScaleBy* actionWithDuration(ccTime duration, float s);
|
||||||
|
static CCScaleBy* actionWithDuration(ccTime duration, float sx, float sy);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCBlink : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCBlink* actionWithDuration(ccTime duration, unsigned int uBlinks);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFadeIn : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCFadeIn* actionWithDuration(ccTime d);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFadeOut : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCFadeOut* actionWithDuration(ccTime d);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFadeTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCFadeTo* actionWithDuration(ccTime duration, GLubyte opacity);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCTintTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCTintTo* actionWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCTintBy : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCTintBy* actionWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCDelayTime : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCDelayTime* actionWithDuration(ccTime d);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCReverseTime : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCReverseTime* actionWithAction(CCFiniteTimeAction *pAction);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCAnimate : public CCActionInterval
|
||||||
|
{
|
||||||
|
CCAnimation* getAnimation(void);
|
||||||
|
void setAnimation(CCAnimation *pAnimation);
|
||||||
|
|
||||||
|
static CCAction* actionWithAnimation(CCAnimation *pAnimation);
|
||||||
|
static CCAction* actionWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
||||||
|
static CCAction* actionWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCProgressTo : public CCAction
|
||||||
|
{
|
||||||
|
static CCAction* actionWithDuration(ccTime duration, float fPercent);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCProgressFromTo : public CCAction
|
||||||
|
{
|
||||||
|
static CCAction* actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class CCFiniteTimeAction : public CCAction
|
// CCActionInstant
|
||||||
{
|
class CCShow : public CCAction
|
||||||
CCFiniteTimeAction();
|
{
|
||||||
~CCFiniteTimeAction(){}
|
static CCAction* action();
|
||||||
//! get duration in seconds of the action
|
};
|
||||||
ccTime getDuration(void);
|
|
||||||
//! set duration in seconds of the action
|
|
||||||
void setDuration(ccTime duration);
|
|
||||||
|
|
||||||
|
class CCHide : public CCAction
|
||||||
virtual CCFiniteTimeAction* reverse(void);
|
{
|
||||||
};
|
static CCAction* action();
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCToggleVisibility : public CCAction
|
||||||
|
{
|
||||||
|
static CCAction* action();
|
||||||
|
};
|
||||||
|
|
||||||
class CCActionInterval;
|
class CCFlipX : public CCAction
|
||||||
class CCRepeatForever;
|
{
|
||||||
|
static CCAction* actionWithFlipX(bool x);
|
||||||
|
};
|
||||||
|
|
||||||
class CCSpeed : public CCAction
|
class CCFlipY : public CCAction
|
||||||
{
|
{
|
||||||
public:
|
static CCAction* actionWithFlipY(bool y);
|
||||||
CCSpeed();
|
};
|
||||||
virtual ~CCSpeed(void);
|
|
||||||
|
|
||||||
float getSpeed(void);
|
class CCPlace : public CCAction //<NSCopying>
|
||||||
/** alter the speed of the inner function in runtime */
|
{
|
||||||
void setSpeed(float fSpeed);
|
static CCAction* actionWithPosition(CCPoint pos);
|
||||||
|
};
|
||||||
/** initializes the action */
|
|
||||||
bool initWithAction(CCActionInterval *pAction, float fRate);
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
void startWithTarget(CCNode* pTarget);
|
|
||||||
void stop();
|
|
||||||
void step(ccTime dt);
|
|
||||||
bool isDone(void);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
|
|
||||||
void setInnerAction(CCActionInterval *pAction);
|
|
||||||
CCActionInterval* getInnerAction();
|
|
||||||
|
|
||||||
static CCSpeed* actionWithAction(CCActionInterval *pAction, float fRate);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCFollow : public CCAction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCFollow();
|
|
||||||
|
|
||||||
bool isBoundarySet(void);
|
|
||||||
void setBoudarySet(bool bValue);
|
|
||||||
bool initWithTarget(CCNode *pFollowedNode);
|
|
||||||
bool initWithTarget(CCNode *pFollowedNode, CCRect rect);
|
|
||||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
virtual void step(ccTime dt);
|
|
||||||
virtual bool isDone(void);
|
|
||||||
virtual void stop(void);
|
|
||||||
|
|
||||||
static CCFollow* actionWithTarget(CCNode *pFollowedNode);
|
|
||||||
static CCFollow* actionWithTarget(CCNode *pFollowedNode, CCRect rect);
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
|
@ -1,33 +1,12 @@
|
||||||
|
|
||||||
#include "CCActionInterval.h"
|
class CCActionCamera : public CCActionInterval
|
||||||
|
{
|
||||||
|
void startWithTarget(CCNode *pTarget);
|
||||||
|
};
|
||||||
|
|
||||||
namespace cocos2d {
|
class CCOrbitCamera : public CCActionCamera
|
||||||
|
{
|
||||||
class CCCamera;
|
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
||||||
class CCActionCamera : public CCActionInterval
|
|
||||||
{
|
|
||||||
CCActionCamera();
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual CCActionInterval * reverse();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCOrbitCamera : public CCActionCamera
|
|
||||||
{
|
|
||||||
|
|
||||||
CCOrbitCamera();
|
|
||||||
static CCOrbitCamera * actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
|
||||||
/** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
|
|
||||||
bool initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
|
||||||
/** positions the camera according to spherical coordinates */
|
|
||||||
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
|
||||||
// super methods
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace cocos2d
|
|
||||||
|
|
||||||
|
static CCOrbitCamera * actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||||
|
};
|
||||||
|
|
|
@ -1,265 +1,114 @@
|
||||||
|
|
||||||
#include "CCActionInterval.h"
|
class CCActionEase : public CCActionInterval
|
||||||
|
{
|
||||||
namespace cocos2d {
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||||
|
};
|
||||||
class CCObject;
|
|
||||||
class CCZone;
|
class CCEaseRateAction : public CCActionInterval
|
||||||
|
{
|
||||||
class CCActionEase : public CCActionInterval
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||||
{
|
};
|
||||||
bool initWithAction(CCActionInterval *pAction);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
class CCEaseIn : public CCActionInterval
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
{
|
||||||
virtual void stop(void);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||||
virtual void update(ccTime time);
|
};
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
static CCActionEase* actionWithAction(CCActionInterval *pAction);
|
class CCEaseOut : public CCActionInterval
|
||||||
};
|
{
|
||||||
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||||
|
};
|
||||||
class CCEaseRateAction : public CCActionEase
|
|
||||||
{
|
class CCEaseInOut : public CCActionInterval
|
||||||
public:
|
{
|
||||||
~CCEaseRateAction(void);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||||
|
};
|
||||||
/** set rate value for the actions */
|
|
||||||
void setRate(float rate);
|
class CCEaseExponentialIn : public CCActionInterval
|
||||||
/** get rate value for the actions */
|
{
|
||||||
float getRate(void);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
|
};
|
||||||
/** Initializes the action with the inner action and the rate parameter */
|
|
||||||
bool initWithAction(CCActionInterval *pAction, float fRate);
|
class CCEaseExponentialOut : public CCActionInterval
|
||||||
|
{
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
virtual CCActionInterval* reverse(void);
|
};
|
||||||
|
|
||||||
static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate);
|
class CCEaseExponentialInOut : public CCActionInterval
|
||||||
};
|
{
|
||||||
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
/**
|
};
|
||||||
@brief CCEaseIn action with a rate
|
|
||||||
*/
|
class CCEaseSineIn : public CCActionInterval
|
||||||
class CCEaseIn : public CCEaseRateAction
|
{
|
||||||
{
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
|
};
|
||||||
public:
|
|
||||||
void update(ccTime time);
|
class CCEaseSineOut : public CCActionInterval
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
{
|
||||||
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate);
|
};
|
||||||
};
|
|
||||||
|
class CCEaseSineInOut : public CCActionInterval
|
||||||
/**
|
{
|
||||||
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
*/
|
};
|
||||||
class CCEaseOut : public CCEaseRateAction
|
|
||||||
{
|
class CCEaseElastic : public CCActionInterval
|
||||||
void update(ccTime time);
|
{
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||||
static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate);
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CCEaseElasticIn : public CCActionInterval
|
||||||
class CCEaseInOut : public CCEaseRateAction
|
{
|
||||||
{
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||||
public:
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||||
virtual void update(ccTime time);
|
};
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
class CCEaseElasticOut : public CCActionInterval
|
||||||
|
{
|
||||||
public:
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||||
/** Creates the action with the inner action and the rate parameter */
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||||
static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate);
|
};
|
||||||
};
|
|
||||||
|
class CCEaseElasticInOut : public CCActionInterval
|
||||||
/**
|
{
|
||||||
@brief CCEase Exponential In
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||||
*/
|
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||||
class CCEaseExponentialIn : public CCActionEase
|
};
|
||||||
{
|
|
||||||
|
class CCEaseBounce : public CCActionInterval
|
||||||
virtual void update(ccTime time);
|
{
|
||||||
virtual CCActionInterval* reverse(void);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
};
|
||||||
static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
class CCEaseBounceIn : public CCActionInterval
|
||||||
|
{
|
||||||
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
class CCEaseExponentialOut : public CCActionEase
|
};
|
||||||
{
|
|
||||||
|
class CCEaseBounceOut : public CCActionInterval
|
||||||
virtual void update(ccTime time);
|
{
|
||||||
virtual CCActionInterval* reverse(void);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
};
|
||||||
|
|
||||||
static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction);
|
class CCEaseBounceInOut : public CCActionInterval
|
||||||
|
{
|
||||||
};
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
|
};
|
||||||
/**
|
|
||||||
@brief Ease Exponential InOut
|
class CCEaseBackIn : public CCActionInterval
|
||||||
*/
|
{
|
||||||
class CCEaseExponentialInOut : public CCActionEase
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
{
|
};
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
class CCEaseBackOut : public CCActionInterval
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
{
|
||||||
static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction);
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
|
};
|
||||||
};
|
|
||||||
|
class CCEaseBackInOut : public CCActionInterval
|
||||||
|
{
|
||||||
class CCEaseSineIn : public CCActionEase
|
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||||
{
|
};
|
||||||
public:
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseSineIn* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseSineOut : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseSineOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCEaseSineInOut : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseSineInOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseElastic : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
float getPeriod(void);
|
|
||||||
void setPeriod(float fPeriod);
|
|
||||||
bool initWithAction(CCActionInterval *pAction, float fPeriod);
|
|
||||||
bool initWithAction(CCActionInterval *pAction);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
|
|
||||||
|
|
||||||
static CCEaseElastic* actionWithAction(CCActionInterval *pAction);
|
|
||||||
/** Creates the action with the inner action and the period in radians (default is 0.3) */
|
|
||||||
static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseElasticIn : public CCEaseElastic
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
|
|
||||||
|
|
||||||
static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction);
|
|
||||||
|
|
||||||
static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseElasticOut : public CCEaseElastic
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction);
|
|
||||||
static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseElasticInOut : public CCEaseElastic
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
|
|
||||||
static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction);
|
|
||||||
|
|
||||||
static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCEaseBounce : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
ccTime bounceTime(ccTime time);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
|
|
||||||
static CCEaseBounce* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCEaseBounceIn : public CCEaseBounce
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseBounceIn* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseBounceOut : public CCEaseBounce
|
|
||||||
{
|
|
||||||
|
|
||||||
void update(ccTime time);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseBounceOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCEaseBounceInOut : public CCEaseBounce
|
|
||||||
{
|
|
||||||
|
|
||||||
void update(ccTime time);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseBounceInOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseBackIn : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseBackIn* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseBackOut : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
void update(ccTime time);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
|
|
||||||
|
|
||||||
static CCEaseBackOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCEaseBackInOut : public CCActionEase
|
|
||||||
{
|
|
||||||
|
|
||||||
void update(ccTime time);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
static CCEaseBackInOut* actionWithAction(CCActionInterval* pAction);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,157 +1,41 @@
|
||||||
|
|
||||||
namespace cocos2d
|
class CCGridAction : public CCActionInterval
|
||||||
{
|
{
|
||||||
class CCGridBase;
|
CCGridBase* getGrid(void);
|
||||||
|
|
||||||
/** @brief Base class for Grid actions */
|
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
||||||
class CCGridAction : public CCActionInterval
|
};
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
|
|
||||||
/** initializes the action with size and duration */
|
class CCAccelDeccelAmplitude : public CCActionInterval
|
||||||
virtual bool initWithSize(ccGridSize gridSize, ccTime duration);
|
{
|
||||||
/** returns the grid */
|
float getRate(void);
|
||||||
virtual CCGridBase* getGrid(void);
|
void setRate(float fRate);
|
||||||
|
|
||||||
public:
|
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||||
/** creates the action with size and duration */
|
};
|
||||||
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
class CCAccelAmplitude : public CCActionInterval
|
||||||
|
{
|
||||||
|
float getRate(void);
|
||||||
|
void setRate(float fRate);
|
||||||
|
|
||||||
/**
|
static CCAccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||||
@brief Base class for CCGrid3D actions.
|
};
|
||||||
Grid3D actions can modify a non-tiled grid.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
class CCGrid3DAction : public CCGridAction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual CCGridBase* getGrid(void);
|
|
||||||
|
|
||||||
ccVertex3F vertex(ccGridSize pos);
|
|
||||||
|
|
||||||
ccVertex3F originalVertex(ccGridSize pos);
|
|
||||||
|
|
||||||
void setVertex(ccGridSize pos, ccVertex3F vertex);
|
|
||||||
|
|
||||||
public:
|
class CCDeccelAmplitude : public CCActionInterval
|
||||||
|
{
|
||||||
static CCGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
float getRate(void);
|
||||||
};
|
void setRate(float fRate);
|
||||||
|
|
||||||
|
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||||
class CCTiledGrid3DAction : public CCGridAction
|
};
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
ccQuad3 tile(ccGridSize pos);
|
|
||||||
|
|
||||||
ccQuad3 originalTile(ccGridSize pos);
|
|
||||||
|
|
||||||
void setTile(ccGridSize pos, ccQuad3 coords);
|
|
||||||
|
|
||||||
|
|
||||||
virtual CCGridBase* getGrid(void);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static CCTiledGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @brief CCAccelDeccelAmplitude action */
|
|
||||||
class CCAccelDeccelAmplitude : public CCActionInterval
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~CCAccelDeccelAmplitude(void);
|
|
||||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
bool initWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
|
|
||||||
/** get amplitude rate */
|
|
||||||
float getRate(void);
|
|
||||||
/** set amplitude rate */
|
|
||||||
void setRate(float fRate);
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCAccelAmplitude action */
|
|
||||||
class CCAccelAmplitude : public CCActionInterval
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~CCAccelAmplitude(void);
|
|
||||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
bool initWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
|
|
||||||
/** get amplitude rate */
|
|
||||||
float getRate(void);
|
|
||||||
/** set amplitude rate */
|
|
||||||
void setRate(float fRate);
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
static CCAccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCDeccelAmplitude action */
|
|
||||||
class CCDeccelAmplitude : public CCActionInterval
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~CCDeccelAmplitude(void);
|
|
||||||
bool initWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
/** get amplitude rate */
|
|
||||||
float getRate(void);
|
|
||||||
/** set amplitude rate */
|
|
||||||
void setRate(float fRate);
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
CCActionInterval* reverse(void);
|
|
||||||
|
|
||||||
|
|
||||||
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCStopGrid action.
|
|
||||||
@warning Don't call this action if another grid action is active.
|
|
||||||
Call if you want to remove the the grid effect. Example:
|
|
||||||
CCSequence::actions(Lens::action(...), CCStopGrid::action(...), NULL);
|
|
||||||
*/
|
|
||||||
class CCStopGrid : public CCActionInstant
|
|
||||||
{
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
|
|
||||||
static CCStopGrid* action(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCReuseGrid action */
|
|
||||||
class CCReuseGrid : public CCActionInstant
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithTimes(int times);
|
|
||||||
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
|
|
||||||
static CCReuseGrid* actionWithTimes(int times);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end of namespace cocos2d
|
|
||||||
|
|
||||||
|
class CCStopGrid : public CCActionInstant
|
||||||
|
{
|
||||||
|
static CCStopGrid* action(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCReuseGrid : public CCActionInstant
|
||||||
|
{
|
||||||
|
static CCReuseGrid* actionWithTimes(int times);
|
||||||
|
};
|
||||||
|
|
|
@ -1,150 +1,83 @@
|
||||||
|
|
||||||
|
class CCWaves3D : public CCGrid3DAction
|
||||||
#include "CCActionGrid.h"
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
{
|
||||||
|
float getAmplitude(void);
|
||||||
|
void setAmplitude(float fAmplitude);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
class CCWaves3D : public CCGrid3DAction
|
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||||
{
|
};
|
||||||
|
|
||||||
float getAmplitude(void);
|
class CCFlipX3D : public CCGrid3DAction
|
||||||
void setAmplitude(float fAmplitude);
|
{
|
||||||
float getAmplitudeRate(void);
|
static CCFlipX3D* actionWithDuration(ccTime duration);
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
};
|
||||||
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
class CCFlipY3D : public CCFlipX3D
|
||||||
void update(ccTime time);
|
{
|
||||||
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
static CCFlipY3D* actionWithDuration(ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCLens3D : public CCGrid3DAction
|
||||||
|
{
|
||||||
|
float getLensEffect(void);
|
||||||
|
void setLensEffect(float fLensEffect);
|
||||||
|
CCPoint getPosition(void);
|
||||||
|
void getPosition(float* x = 0, float* y = 0);
|
||||||
|
void setPosition(CCPoint position);
|
||||||
|
void setPosition(float x, float y);
|
||||||
|
|
||||||
};
|
static CCLens3D* actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCRipple3D : public CCGrid3DAction
|
||||||
|
{
|
||||||
|
CCPoint getPosition(void);
|
||||||
|
void getPosition(float* x = 0, float* y = 0);
|
||||||
|
void setPosition(CCPoint position);
|
||||||
|
void setPosition(float x, float y);
|
||||||
|
float getAmplitude(void);
|
||||||
|
void setAmplitude(float fAmplitude);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
class CCFlipX3D : public CCGrid3DAction
|
static CCRipple3D* actionWithPosition(CCPoint pos, float r, int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||||
{
|
};
|
||||||
|
|
||||||
bool initWithDuration(ccTime duration);
|
class CCShaky3D : public CCGrid3DAction
|
||||||
bool initWithSize(ccGridSize gridSize, ccTime duration);
|
{
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
|
||||||
void update(ccTime time);
|
};
|
||||||
static CCFlipX3D* actionWithDuration(ccTime duration);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
class CCLiquid : public CCGrid3DAction
|
||||||
|
{
|
||||||
|
float getAmplitude(void);
|
||||||
|
void setAmplitude(float fAmplitude);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
class CCFlipY3D : public CCFlipX3D
|
static CCLiquid* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||||
{
|
};
|
||||||
|
|
||||||
void update(ccTime time);
|
class CCWaves : public CCGrid3DAction
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
{
|
||||||
static CCFlipY3D* actionWithDuration(ccTime duration);
|
float getAmplitude(void);
|
||||||
};
|
void setAmplitude(float fAmplitude);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
|
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize,ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
class CCLens3D : public CCGrid3DAction
|
class CCTwirl : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCPoint getPosition(void);
|
||||||
float getLensEffect(void);
|
void setPosition(CCPoint position);
|
||||||
void setLensEffect(float fLensEffect);
|
float getAmplitude(void);
|
||||||
|
void setAmplitude(float fAmplitude);
|
||||||
CCPoint getPosition(void);
|
float getAmplitudeRate(void);
|
||||||
void setPosition(CCPoint position);
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
bool initWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
static CCLens3D* actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCRipple3D action */
|
|
||||||
class CCRipple3D : public CCGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
CCPoint getPosition(void);
|
|
||||||
void setPosition(CCPoint position);
|
|
||||||
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
|
|
||||||
|
|
||||||
bool initWithPosition(CCPoint pos, float r, int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
static CCRipple3D* actionWithPosition(CCPoint pos, float r, int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCShaky3D : public CCGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
|
|
||||||
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCLiquid action */
|
|
||||||
class CCLiquid : public CCGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
static CCLiquid* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCWaves action */
|
|
||||||
class CCWaves : public CCGrid3DAction
|
|
||||||
{
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
bool initWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize,ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCTwirl : public CCGrid3DAction
|
|
||||||
{
|
|
||||||
CCPoint getPosition(void);
|
|
||||||
void setPosition(CCPoint position);
|
|
||||||
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
bool initWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
|
|
||||||
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,ccTime duration);
|
||||||
|
};
|
||||||
|
|
|
@ -1,153 +0,0 @@
|
||||||
|
|
||||||
#include "CCAction.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
|
|
||||||
class CCActionInstant : public CCFiniteTimeAction
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCActionInstant();
|
|
||||||
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
bool isDone(void);
|
|
||||||
void step(ccTime dt);
|
|
||||||
void update(ccTime time);
|
|
||||||
CCFiniteTimeAction * reverse(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCShow : public CCActionInstant
|
|
||||||
{
|
|
||||||
|
|
||||||
CCShow(){}
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual CCFiniteTimeAction * reverse(void);
|
|
||||||
static CCShow * action();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCHide : public CCActionInstant
|
|
||||||
{
|
|
||||||
|
|
||||||
CCHide(){}
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual CCFiniteTimeAction * reverse(void);
|
|
||||||
static CCHide * action();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCToggleVisibility : public CCActionInstant
|
|
||||||
{
|
|
||||||
|
|
||||||
CCToggleVisibility();
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
static CCToggleVisibility * action();
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCFlipX : public CCActionInstant
|
|
||||||
{
|
|
||||||
|
|
||||||
CCFlipX();
|
|
||||||
|
|
||||||
static CCFlipX * actionWithFlipX(bool x);
|
|
||||||
|
|
||||||
bool initWithFlipX(bool x);
|
|
||||||
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
CCFiniteTimeAction * reverse(void);
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCFlipY : public CCActionInstant
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCFlipY();
|
|
||||||
static CCFlipY * actionWithFlipY(bool y);
|
|
||||||
bool initWithFlipY(bool y);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
CCFiniteTimeAction * reverse(void);
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCPlace : public CCActionInstant //<NSCopying>
|
|
||||||
{
|
|
||||||
CCPlace();
|
|
||||||
static CCPlace * actionWithPosition(CCPoint pos);
|
|
||||||
bool initWithPosition(CCPoint pos);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief Calls a 'callback'
|
|
||||||
*/
|
|
||||||
class CCCallFunc : public CCActionInstant //<NSCopying>
|
|
||||||
{
|
|
||||||
CCCallFunc();
|
|
||||||
static CCCallFunc * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFunc selector);
|
|
||||||
static CCCallFunc* actionWithScriptFuncName(const char* pszFuncName);
|
|
||||||
bool initWithTarget(CCObject* pSelectorTarget);
|
|
||||||
bool initWithScriptFuncName(const char* pszFuncName);
|
|
||||||
void execute();
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
CCObject * copyWithZone(cocos2d::CCZone *pZone);
|
|
||||||
|
|
||||||
CCObject* getTargetCallback();
|
|
||||||
void setTargetCallback(CCObject* pSel);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCCallFuncN : public CCCallFunc
|
|
||||||
{
|
|
||||||
CCCallFuncN();
|
|
||||||
static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
|
|
||||||
static CCCallFuncN* actionWithScriptFuncName(const char* pszFuncName);
|
|
||||||
bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
void execute();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CCCallFuncND : public CCCallFuncN
|
|
||||||
{
|
|
||||||
|
|
||||||
/** creates the action with the callback and the data to pass as an argument */
|
|
||||||
static CCCallFuncND * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
||||||
static CCCallFuncND* actionWithScriptFuncName(const char* pszFuncName, void *d);
|
|
||||||
/** initializes the action with the callback and the data to pass as an argument */
|
|
||||||
virtual bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
||||||
// super methods
|
|
||||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
virtual void execute();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CCCallFuncO : public CCCallFunc
|
|
||||||
{
|
|
||||||
|
|
||||||
CCCallFuncO();
|
|
||||||
|
|
||||||
static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
||||||
static CCCallFuncO* actionWithScriptFuncName(const char* pszFuncName);
|
|
||||||
|
|
||||||
bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
void execute();
|
|
||||||
|
|
||||||
CCObject* getObject();
|
|
||||||
void setObject(CCObject* pObj);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,376 +0,0 @@
|
||||||
|
|
||||||
#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 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 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);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,31 +1,15 @@
|
||||||
|
|
||||||
#include "CCAction.h"
|
class CCActionManager : public CCObject
|
||||||
#include "CCMutableArray.h"
|
|
||||||
#include "CCObject.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
struct _hashElement;
|
|
||||||
|
|
||||||
class CCActionManager : public CCObject
|
|
||||||
{
|
{
|
||||||
public:
|
void removeAllActions(void);
|
||||||
CCActionManager(void);
|
void removeAllActionsFromTarget(CCObject *pTarget);
|
||||||
bool init(void);
|
void removeAction(CCAction *pAction);
|
||||||
void addAction(CCAction *pAction, CCNode *pTarget, bool paused);
|
void removeActionByTag(int tag, CCObject *pTarget);
|
||||||
void removeAllActions(void);
|
|
||||||
void removeAllActionsFromTarget(CCObject *pTarget);
|
|
||||||
void removeAction(CCAction *pAction);
|
|
||||||
void removeActionByTag(int tag, CCObject *pTarget);
|
|
||||||
CCAction* getActionByTag(int tag, CCObject *pTarget);
|
|
||||||
int numberOfRunningActionsInTarget(CCObject *pTarget);
|
|
||||||
void pauseTarget(CCObject *pTarget);
|
|
||||||
void resumeTarget(CCObject *pTarget);
|
|
||||||
void purgeSharedManager(void);
|
|
||||||
static CCActionManager* sharedManager(void);
|
|
||||||
|
|
||||||
|
int numberOfRunningActionsInTarget(CCObject *pTarget);
|
||||||
|
|
||||||
|
void pauseTarget(CCObject *pTarget);
|
||||||
|
void resumeTarget(CCObject *pTarget);
|
||||||
|
|
||||||
|
static CCActionManager* sharedManager(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
|
|
||||||
#include "CCActionGrid3D.h"
|
class CCPageTurn3D : public CCGrid3DAction
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
{
|
||||||
|
static CCPageTurn3D* actionWithSize(ccGridSize gridSize, ccTime time);
|
||||||
class CCPageTurn3D : public CCGrid3DAction
|
};
|
||||||
{
|
|
||||||
void update(ccTime time);
|
|
||||||
static CCPageTurn3D* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
|
|
||||||
#include "CCActionInterval.h"
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
class CCProgressTo : public CCActionInterval
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
bool initWithDuration(ccTime duration, float fPercent);
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
void update(ccTime time);
|
|
||||||
static CCProgressTo* actionWithDuration(ccTime duration, float fPercent);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCProgressFromTo : public CCActionInterval
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage);
|
|
||||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
virtual CCActionInterval* reverse(void);
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
static CCProgressFromTo* actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end of namespace cocos2d
|
|
||||||
|
|
|
@ -1,160 +1,83 @@
|
||||||
|
|
||||||
#include "CCActionGrid.h"
|
class CCShakyTiles3D : public CCTiledGrid3DAction
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
{
|
||||||
|
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
class CCShakyTiles3D : public CCTiledGrid3DAction
|
class CCShatteredTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
bool initWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,ccTime duration);
|
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
class CCShuffleTiles : public CCTiledGrid3DAction
|
||||||
void update(ccTime time);
|
{
|
||||||
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,
|
void shuffle(int *pArray, int nLen);
|
||||||
ccTime duration);
|
ccGridSize getDelta(ccGridSize pos);
|
||||||
|
void placeTile(ccGridSize pos, Tile *t);
|
||||||
|
|
||||||
};
|
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFadeOutTRTiles : public CCTiledGrid3DAction
|
||||||
|
{
|
||||||
|
void turnOnTile(ccGridSize pos);
|
||||||
|
void turnOffTile(ccGridSize pos);
|
||||||
|
void transformTile(ccGridSize pos, float distance);
|
||||||
|
|
||||||
class CCShatteredTiles3D : public CCTiledGrid3DAction
|
static CCFadeOutTRTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
||||||
{
|
};
|
||||||
|
|
||||||
bool initWithRange(int nRange, bool bShatterZ, ccGridSize gridSize, ccTime duration);
|
class CCFadeOutBLTiles : public CCFadeOutTRTiles
|
||||||
|
{
|
||||||
|
static CCFadeOutBLTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
||||||
|
};
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
class CCFadeOutUpTiles : public CCFadeOutTRTiles
|
||||||
void update(ccTime time);
|
{
|
||||||
|
static CCFadeOutUpTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCFadeOutDownTiles : public CCFadeOutUpTiles
|
||||||
|
{
|
||||||
|
static CCFadeOutDownTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
||||||
|
};
|
||||||
|
|
||||||
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize,
|
class CCTurnOffTiles : public CCTiledGrid3DAction
|
||||||
ccTime duration);
|
{
|
||||||
};
|
void shuffle(int *pArray, int nLen);
|
||||||
|
void turnOnTile(ccGridSize pos);
|
||||||
|
void turnOffTile(ccGridSize pos);
|
||||||
|
|
||||||
struct Tile;
|
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d);
|
||||||
|
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
class CCShuffleTiles : public CCTiledGrid3DAction
|
class CCWavesTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
float getAmplitude(void);
|
||||||
|
void setAmplitude(float fAmplitude);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||||
void shuffle(int *pArray, int nLen);
|
};
|
||||||
ccGridSize getDelta(ccGridSize pos);
|
|
||||||
void placeTile(ccGridSize pos, Tile *t);
|
|
||||||
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
class CCJumpTiles3D : public CCTiledGrid3DAction
|
||||||
virtual void update(ccTime time);
|
{
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
float getAmplitude(void);
|
||||||
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
void setAmplitude(float fAmplitude);
|
||||||
};
|
float getAmplitudeRate(void);
|
||||||
|
void setAmplitudeRate(float fAmplitudeRate);
|
||||||
|
|
||||||
|
static CCJumpTiles3D* actionWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
|
||||||
|
};
|
||||||
|
|
||||||
class CCFadeOutTRTiles : public CCTiledGrid3DAction
|
class CCSplitRows : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
static CCSplitRows* actionWithRows(int nRows, ccTime duration);
|
||||||
float testFunc(ccGridSize pos, ccTime time);
|
};
|
||||||
void turnOnTile(ccGridSize pos);
|
|
||||||
void turnOffTile(ccGridSize pos);
|
|
||||||
virtual void transformTile(ccGridSize pos, float distance);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
static CCFadeOutTRTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCFadeOutBLTiles : public CCFadeOutTRTiles
|
|
||||||
{
|
|
||||||
|
|
||||||
float testFunc(ccGridSize pos, ccTime time);
|
|
||||||
static CCFadeOutBLTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCFadeOutUpTiles : public CCFadeOutTRTiles
|
|
||||||
{
|
|
||||||
|
|
||||||
float testFunc(ccGridSize pos, ccTime time);
|
|
||||||
virtual void transformTile(ccGridSize pos, float distance);
|
|
||||||
static CCFadeOutUpTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCFadeOutDownTiles : public CCFadeOutUpTiles
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual float testFunc(ccGridSize pos, ccTime time);
|
|
||||||
static CCFadeOutDownTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCTurnOffTiles : public CCTiledGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
|
||||||
void shuffle(int *pArray, int nLen);
|
|
||||||
void turnOnTile(ccGridSize pos);
|
|
||||||
void turnOffTile(ccGridSize pos);
|
|
||||||
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
void update(ccTime time);
|
|
||||||
|
|
||||||
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d);
|
|
||||||
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCWavesTiles3D action. */
|
|
||||||
class CCWavesTiles3D : public CCTiledGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCJumpTiles3D action.
|
|
||||||
A sin function is executed to move the tiles across the Z axis
|
|
||||||
*/
|
|
||||||
class CCJumpTiles3D : public CCTiledGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
float getAmplitude(void);
|
|
||||||
void setAmplitude(float fAmplitude);
|
|
||||||
float getAmplitudeRate(void);
|
|
||||||
void setAmplitudeRate(float fAmplitudeRate);
|
|
||||||
bool initWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
static CCJumpTiles3D* actionWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCSplitRows action */
|
|
||||||
class CCSplitRows : public CCTiledGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithRows(int nRows, ccTime duration);
|
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
void update(ccTime time);
|
|
||||||
void startWithTarget(CCNode *pTarget);
|
|
||||||
static CCSplitRows* actionWithRows(int nRows, ccTime duration);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCSplitCols action */
|
|
||||||
class CCSplitCols : public CCTiledGrid3DAction
|
|
||||||
{
|
|
||||||
|
|
||||||
bool initWithCols(int nCols, ccTime duration);
|
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
||||||
virtual void update(ccTime time);
|
|
||||||
virtual void startWithTarget(CCNode *pTarget);
|
|
||||||
static CCSplitCols* actionWithCols(int nCols, ccTime duration);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
} // end of namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
class CCSplitCols : public CCTiledGrid3DAction
|
||||||
|
{
|
||||||
|
static CCSplitCols* actionWithCols(int nCols, ccTime duration);
|
||||||
|
};
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
struct CCAffineTransform {
|
struct CCAffineTransform {
|
||||||
CGFloat a, b, c, d;
|
CGFloat a, b, c, d;
|
||||||
CGFloat tx, ty;
|
CGFloat tx, ty;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
|
CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
|
||||||
CCAffineTransform CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
|
CCAffineTransform CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
|
||||||
|
|
||||||
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
||||||
CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
||||||
|
|
||||||
|
|
||||||
CCSize CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t);
|
CCSize CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t);
|
||||||
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t);
|
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t);
|
||||||
|
|
||||||
|
@ -23,8 +22,3 @@ CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CGFloat sx, CGFloa
|
||||||
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2);
|
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2);
|
||||||
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
|
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
|
||||||
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
|
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
|
||||||
|
|
||||||
//extern const CCAffineTransform CCAffineTransformIdentity;
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,20 @@
|
||||||
|
|
||||||
#include "CCPlatformConfig.h"
|
class CCAnimation : public CCObject
|
||||||
#include "CCObject.h"
|
{
|
||||||
#include "CCMutableArray.h"
|
const char* getName(void);
|
||||||
#include "CCGeometry.h"
|
void setName(const char *pszName);
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace cocos2d {
|
float getDelay(void);
|
||||||
|
void setDelay(float fDelay);
|
||||||
|
|
||||||
class CCSpriteFrame;
|
CCMutableArray<CCSpriteFrame*>* getFrames(void);
|
||||||
class CCTexture2D;
|
void setFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||||
|
|
||||||
class CCAnimation : public CCObject
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
const char* getName(void);
|
|
||||||
void setName(const char *pszName);
|
|
||||||
float getDelay(void);
|
|
||||||
void setDelay(float fDelay);
|
|
||||||
CCMutableArray<CCSpriteFrame*>* getFrames(void);
|
|
||||||
void setFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
|
||||||
|
|
||||||
bool initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
|
||||||
|
|
||||||
bool initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames, float delay);
|
|
||||||
|
|
||||||
void addFrame(CCSpriteFrame *pFrame);
|
|
||||||
|
|
||||||
void addFrameWithFileName(const char *pszFileName);
|
void addFrame(CCSpriteFrame *pFrame);
|
||||||
|
void addFrameWithFileName(const char *pszFileName);
|
||||||
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
||||||
|
|
||||||
bool init(void);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static CCAnimation* animation(void);
|
|
||||||
|
|
||||||
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames);
|
|
||||||
|
|
||||||
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames, float delay);
|
|
||||||
};
|
|
||||||
} // end of name sapce cocos2d
|
|
||||||
|
|
||||||
|
static CCAnimation* animation(void);
|
||||||
|
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames);
|
||||||
|
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames, float delay);
|
||||||
|
};
|
||||||
|
|
|
@ -1,32 +1,10 @@
|
||||||
|
|
||||||
#include "CCObject.h"
|
class CCAnimationCache : public CCObject
|
||||||
#include "CCMutableDictionary.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
{
|
||||||
class CCAnimation;
|
void addAnimation(CCAnimation *animation, const char * name);
|
||||||
|
void removeAnimationByName(const char* name);
|
||||||
|
CCAnimation* animationByName(const char* name);
|
||||||
|
|
||||||
/** Singleton that manages the Animations.
|
static CCAnimationCache* sharedAnimationCache(void);
|
||||||
It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
|
static void purgeSharedAnimationCache(void);
|
||||||
|
};
|
||||||
Before v0.99.5, the recommend way was to save them on the CCSprite. Since v0.99.5, you should use this class instead.
|
|
||||||
|
|
||||||
@since v0.99.5
|
|
||||||
*/
|
|
||||||
class CCAnimationCache : public CCObject
|
|
||||||
{
|
|
||||||
|
|
||||||
CCAnimationCache();
|
|
||||||
static CCAnimationCache* sharedAnimationCache(void);
|
|
||||||
static void purgeSharedAnimationCache(void);
|
|
||||||
|
|
||||||
void addAnimation(CCAnimation *animation, const char * name);
|
|
||||||
void removeAnimationByName(const char* name);
|
|
||||||
CCAnimation* animationByName(const char* name);
|
|
||||||
|
|
||||||
bool init(void);
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
|
||||||
#include "platform/CCApplication_platform.h"
|
typedef enum LanguageType
|
||||||
|
{
|
||||||
|
kLanguageEnglish = 0,
|
||||||
|
kLanguageChinese,
|
||||||
|
kLanguageFrench,
|
||||||
|
kLanguageItalian,
|
||||||
|
kLanguageGerman,
|
||||||
|
kLanguageSpanish,
|
||||||
|
kLanguageRussian
|
||||||
|
} ccLanguageType;
|
||||||
|
|
||||||
|
class CCApplication
|
||||||
|
{
|
||||||
|
static CCApplication& sharedApplication();
|
||||||
|
static ccLanguageType getCurrentLanguage();
|
||||||
|
};
|
||||||
|
|
|
@ -1,51 +1,34 @@
|
||||||
|
|
||||||
#include "support/data_support/ccCArray.h"
|
class CCArray : public CCObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
{
|
||||||
|
unsigned int count();
|
||||||
|
unsigned int capacity();
|
||||||
|
|
||||||
class CCArray : public CCObject
|
unsigned int indexOfObject(CCObject* object);
|
||||||
{
|
CCObject* objectAtIndex(unsigned int index);
|
||||||
|
CCObject* lastObject();
|
||||||
|
CCObject* randomObject();
|
||||||
|
|
||||||
static CCArray* array();
|
bool containsObject(CCObject* object);
|
||||||
static CCArray* arrayWithCapacity(unsigned int capacity);
|
|
||||||
static CCArray* arrayWithArray(CCArray* otherArray);
|
|
||||||
|
|
||||||
bool init();
|
void addObject(CCObject* object);
|
||||||
bool initWithCapacity(unsigned int capacity);
|
void addObjectsFromArray(CCArray* otherArray);
|
||||||
bool initWithArray(CCArray* otherArray);
|
void insertObject(CCObject* object, unsigned int index);
|
||||||
|
|
||||||
unsigned int count();
|
void removeLastObject();
|
||||||
unsigned int capacity();
|
void removeObject(CCObject* object);
|
||||||
unsigned int indexOfObject(CCObject* object);
|
void removeObjectAtIndex(unsigned int index);
|
||||||
CCObject* objectAtIndex(unsigned int index);
|
void removeObjectsInArray(CCArray* otherArray);
|
||||||
CCObject* lastObject();
|
void removeAllObjects();
|
||||||
CCObject* randomObject();
|
void fastRemoveObject(CCObject* object);
|
||||||
bool containsObject(CCObject* object);
|
void fastRemoveObjectAtIndex(unsigned int index);
|
||||||
|
|
||||||
void addObject(CCObject* object);
|
|
||||||
void addObjectsFromArray(CCArray* otherArray);
|
|
||||||
void insertObject(CCObject* object, unsigned int index);
|
|
||||||
|
|
||||||
void removeLastObject();
|
|
||||||
void removeObject(CCObject* object);
|
|
||||||
void removeObjectAtIndex(unsigned int index);
|
|
||||||
void removeObjectsInArray(CCArray* otherArray);
|
|
||||||
void removeAllObjects();
|
|
||||||
void fastRemoveObject(CCObject* object);
|
|
||||||
void fastRemoveObjectAtIndex(unsigned int index);
|
|
||||||
|
|
||||||
void exchangeObject(CCObject* object1, CCObject* object2);
|
void exchangeObject(CCObject* object1, CCObject* object2);
|
||||||
void exchangeObjectAtIndex(unsigned int index1, unsigned int index2);
|
void exchangeObjectAtIndex(unsigned int index1, unsigned int index2);
|
||||||
void reverseObjects();
|
void reverseObjects();
|
||||||
void reduceMemoryFootprint();
|
void reduceMemoryFootprint();
|
||||||
|
|
||||||
public:
|
|
||||||
ccArray* data;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
static CCArray* array();
|
||||||
|
static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||||
|
static CCArray* arrayWithArray(CCArray* otherArray);
|
||||||
|
};
|
||||||
|
|
|
@ -1,28 +1,9 @@
|
||||||
|
|
||||||
#include "CCNode.h"
|
class CCAtlasNode : public CCNode
|
||||||
#include "CCProtocols.h"
|
{
|
||||||
#include "ccTypes.h"
|
void updateAtlasValues();
|
||||||
|
CCTexture2D* getTexture(void);
|
||||||
namespace cocos2d {
|
void setTexture(CCTexture2D *texture);
|
||||||
class CCTextureAtlas;
|
|
||||||
|
|
||||||
class CCAtlasNode : public CCNode, public CCRGBAProtocol, public CCTextureProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
CCAtlasNode();
|
|
||||||
|
|
||||||
static CCAtlasNode * atlasWithTileFile(const char* tile,unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
|
||||||
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
|
||||||
|
|
||||||
void updateAtlasValues();
|
|
||||||
|
|
||||||
void draw();
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
void setTexture(CCTexture2D *texture);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static CCAtlasNode * atlasWithTileFile(const char* tile,unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||||
|
};
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
|
|
||||||
#include "CCObject.h"
|
|
||||||
#include "CCMutableArray.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
class CCAutoreleasePool : public CCObject
|
|
||||||
{
|
|
||||||
|
|
||||||
CCAutoreleasePool(void);
|
|
||||||
void addObject(CCObject *pObject);
|
|
||||||
void removeObject(CCObject *pObject);
|
|
||||||
void clear();
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCPoolManager
|
|
||||||
{
|
|
||||||
|
|
||||||
CCPoolManager();
|
|
||||||
void finalize();
|
|
||||||
void push();
|
|
||||||
void pop();
|
|
||||||
void removeObject(CCObject* pObject);
|
|
||||||
void addObject(CCObject* pObject);
|
|
||||||
static CCPoolManager* getInstance();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,22 @@
|
||||||
|
|
||||||
#include "CCObject.h"
|
class CCCamera : public CCObject
|
||||||
#include "ccMacros.h"
|
{
|
||||||
#include <string>
|
CCCamera(void);
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCCamera : public CCObject
|
void init(void);
|
||||||
{
|
char * description(void);
|
||||||
|
|
||||||
CCCamera(void);
|
void setDirty(bool bValue);
|
||||||
|
bool getDirty(void);
|
||||||
void init(void);
|
void restore(void);
|
||||||
char * description(void);
|
void locate(void);
|
||||||
|
void setEyeXYZ(float fEyeX, float fEyeY, float fEyeZ);
|
||||||
/** sets the dirty value */
|
void setCenterXYZ(float fCenterX, float fCenterY, float fCenterZ);
|
||||||
void setDirty(bool bValue);
|
void setUpXYZ(float fUpX, float fUpY, float fUpZ);
|
||||||
bool getDirty(void);
|
|
||||||
void restore(void);
|
|
||||||
/** Sets the camera using gluLookAt using its eye, center and up_vector */
|
|
||||||
void locate(void);
|
|
||||||
/** sets the eye values in points */
|
|
||||||
void setEyeXYZ(float fEyeX, float fEyeY, float fEyeZ);
|
|
||||||
/** sets the center values in points */
|
|
||||||
void setCenterXYZ(float fCenterX, float fCenterY, float fCenterZ);
|
|
||||||
/** sets the up values */
|
|
||||||
void setUpXYZ(float fUpX, float fUpY, float fUpZ);
|
|
||||||
|
|
||||||
/** get the eye vector values in points */
|
|
||||||
void getEyeXYZ(float *pEyeX, float *pEyeY, float *pEyeZ);
|
|
||||||
/** get the center vector values int points */
|
|
||||||
void getCenterXYZ(float *pCenterX, float *pCenterY, float *pCenterZ);
|
|
||||||
/** get the up vector values */
|
|
||||||
void getUpXYZ(float *pUpX, float *pUpY, float *pUpZ);
|
|
||||||
|
|
||||||
static float getZEye();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
void getEyeXYZ(float *pEyeX, float *pEyeY, float *pEyeZ);
|
||||||
|
void getCenterXYZ(float *pCenterX, float *pCenterY, float *pCenterZ);
|
||||||
|
void getUpXYZ(float *pUpX, float *pUpY, float *pUpZ);
|
||||||
|
|
||||||
|
static float getZEye();
|
||||||
|
};
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
|
|
||||||
void CCLuaLog(const char * pszFormat);
|
void CCLuaLog(const char * pszFormat);
|
||||||
/**
|
void CCMessageBox(const char * pszMsg, const char * pszTitle);
|
||||||
@brief Pop out a message box
|
|
||||||
*/
|
|
||||||
void CCMessageBox(const char * pszMsg, const char * pszTitle);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCData : public CCObject
|
|
||||||
{
|
|
||||||
CCData(void);
|
|
||||||
~CCData(void);
|
|
||||||
|
|
||||||
void* bytes(void);
|
|
||||||
static CCData* dataWithBytes(unsigned char *pBytes, int size);
|
|
||||||
static CCData* dataWithContentsOfFile(const std::string &strPath);
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
|
@ -1,150 +1,43 @@
|
||||||
#include "platform/CCPlatformMacros.h"
|
|
||||||
#include "CCObject.h"
|
|
||||||
#include "ccTypes.h"
|
|
||||||
#include "CCGeometry.h"
|
|
||||||
#include "CCMutableArray.h"
|
|
||||||
#include "CCGeometry.h"
|
|
||||||
#include "CCEGLView.h"
|
|
||||||
#include "CCGL.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
typedef enum {
|
||||||
|
/// Device oriented vertically, home button on the bottom
|
||||||
|
kCCDeviceOrientationPortrait = 0, // UIDeviceOrientationPortrait,
|
||||||
|
/// Device oriented vertically, home button on the top
|
||||||
|
kCCDeviceOrientationPortraitUpsideDown = 1, // UIDeviceOrientationPortraitUpsideDown,
|
||||||
|
/// Device oriented horizontally, home button on the right
|
||||||
|
kCCDeviceOrientationLandscapeLeft = 2, // UIDeviceOrientationLandscapeLeft,
|
||||||
|
/// Device oriented horizontally, home button on the left
|
||||||
|
kCCDeviceOrientationLandscapeRight = 3, // UIDeviceOrientationLandscapeRight,
|
||||||
|
} ccDeviceOrientation;
|
||||||
|
|
||||||
typedef enum {
|
class CCDirector : public CCObject
|
||||||
/// sets a 2D projection (orthogonal projection)
|
{
|
||||||
kCCDirectorProjection2D,
|
CCScene* getRunningScene(void);
|
||||||
|
|
||||||
/// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
|
double getAnimationInterval(void);
|
||||||
kCCDirectorProjection3D,
|
|
||||||
|
|
||||||
/// it calls "updateProjection" on the projection delegate.
|
bool isDisplayFPS(void);
|
||||||
kCCDirectorProjectionCustom,
|
void setDisplayFPS(bool bDisplayFPS);
|
||||||
|
|
||||||
/// Detault projection is 3D projection
|
bool isRetinaDisplay();
|
||||||
kCCDirectorProjectionDefault = kCCDirectorProjection3D,
|
bool isPaused(void);
|
||||||
|
unsigned int getFrames(void);
|
||||||
|
|
||||||
// backward compatibility stuff
|
CCSize getWinSize(void);
|
||||||
CCDirectorProjection2D = kCCDirectorProjection2D,
|
CCSize getWinSizeInPixels(void);
|
||||||
CCDirectorProjection3D = kCCDirectorProjection3D,
|
CCSize getDisplaySizeInPixels(void);
|
||||||
CCDirectorProjectionCustom = kCCDirectorProjectionCustom,
|
|
||||||
} ccDirectorProjection;
|
|
||||||
|
|
||||||
|
CCPoint convertToGL(CCPoint obPoint);
|
||||||
typedef enum {
|
CCPoint convertToUI(CCPoint obPoint);
|
||||||
kCCDirectorTypeNSTimer,
|
|
||||||
kCCDirectorTypeMainLoop,
|
|
||||||
kCCDirectorTypeThreadMainLoop,
|
|
||||||
kCCDirectorTypeDisplayLink,
|
|
||||||
kCCDirectorTypeDefault = kCCDirectorTypeNSTimer,
|
|
||||||
CCDirectorTypeNSTimer = kCCDirectorTypeNSTimer,
|
|
||||||
CCDirectorTypeMainLoop = kCCDirectorTypeMainLoop,
|
|
||||||
CCDirectorTypeThreadMainLoop = kCCDirectorTypeThreadMainLoop,
|
|
||||||
CCDirectorTypeDisplayLink = kCCDirectorTypeDisplayLink,
|
|
||||||
CCDirectorTypeDefault =kCCDirectorTypeDefault,
|
|
||||||
} ccDirectorType;
|
|
||||||
|
|
||||||
typedef enum {
|
void runWithScene(CCScene *pScene);
|
||||||
/// Device oriented vertically, home button on the bottom
|
void pushScene(CCScene *pScene);
|
||||||
kCCDeviceOrientationPortrait = 0, // UIDeviceOrientationPortrait,
|
void popScene(void);
|
||||||
/// Device oriented vertically, home button on the top
|
void replaceScene(CCScene *pScene);
|
||||||
kCCDeviceOrientationPortraitUpsideDown = 1, // UIDeviceOrientationPortraitUpsideDown,
|
|
||||||
/// Device oriented horizontally, home button on the right
|
|
||||||
kCCDeviceOrientationLandscapeLeft = 2, // UIDeviceOrientationLandscapeLeft,
|
|
||||||
/// Device oriented horizontally, home button on the left
|
|
||||||
kCCDeviceOrientationLandscapeRight = 3, // UIDeviceOrientationLandscapeRight,
|
|
||||||
|
|
||||||
// Backward compatibility stuff
|
CGFloat getContentScaleFactor(void);
|
||||||
CCDeviceOrientationPortrait = kCCDeviceOrientationPortrait,
|
|
||||||
CCDeviceOrientationPortraitUpsideDown = kCCDeviceOrientationPortraitUpsideDown,
|
|
||||||
CCDeviceOrientationLandscapeLeft = kCCDeviceOrientationLandscapeLeft,
|
|
||||||
CCDeviceOrientationLandscapeRight = kCCDeviceOrientationLandscapeRight,
|
|
||||||
} ccDeviceOrientation;
|
|
||||||
|
|
||||||
class CCLabelTTF;
|
|
||||||
class CCScene;
|
|
||||||
class CCEGLView;
|
|
||||||
class CCNode;
|
|
||||||
class CCProjectionProtocol;
|
|
||||||
|
|
||||||
class CCDirector : public CCObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool init(void);
|
|
||||||
CCDirector(void);
|
|
||||||
|
|
||||||
|
|
||||||
CCScene* getRunningScene(void);
|
|
||||||
|
|
||||||
|
|
||||||
double getAnimationInterval(void);
|
|
||||||
void setAnimationInterval(double dValue);
|
|
||||||
bool isDisplayFPS(void);
|
|
||||||
void setDisplayFPS(bool bDisplayFPS);
|
|
||||||
CC_GLVIEW* getOpenGLView(void);
|
|
||||||
void setOpenGLView(CC_GLVIEW *pobOpenGLView);
|
|
||||||
bool isNextDeltaTimeZero(void);
|
|
||||||
void setNextDeltaTimeZero(bool bNextDeltaTimeZero);
|
|
||||||
bool isPaused(void);
|
|
||||||
unsigned int getFrames(void);
|
|
||||||
ccDirectorProjection getProjection(void);
|
|
||||||
void setProjection(ccDirectorProjection kProjection);
|
|
||||||
bool isSendCleanupToScene(void);
|
|
||||||
CCSize getWinSize(void);
|
|
||||||
CCSize getWinSizeInPixels(void);
|
|
||||||
CCSize getDisplaySizeInPixels(void);
|
|
||||||
void reshapeProjection(CCSize newWindowSize);
|
|
||||||
CCPoint convertToGL(CCPoint obPoint);
|
|
||||||
CCPoint convertToUI(CCPoint obPoint);
|
|
||||||
float getZEye(void);
|
|
||||||
void runWithScene(CCScene *pScene);
|
|
||||||
void pushScene(CCScene *pScene);
|
|
||||||
void popScene(void);
|
|
||||||
void replaceScene(CCScene *pScene);
|
|
||||||
void endToLua(void);
|
|
||||||
void pause(void);
|
|
||||||
void resume(void);
|
|
||||||
void drawScene(void);
|
|
||||||
void purgeCachedData(void);
|
|
||||||
void setGLDefaultValues(void);
|
|
||||||
|
|
||||||
/** enables/disables OpenGL alpha blending */
|
|
||||||
void setAlphaBlending(bool bOn);
|
|
||||||
|
|
||||||
/** enables/disables OpenGL depth test */
|
|
||||||
void setDepthTest(bool bOn);
|
|
||||||
|
|
||||||
virtual void mainLoop(void) = 0;
|
|
||||||
|
|
||||||
// Profiler
|
|
||||||
void showProfilers(void);
|
|
||||||
|
|
||||||
/** rotates the screen if an orientation different than Portrait is used */
|
|
||||||
void applyOrientation(void);
|
|
||||||
|
|
||||||
ccDeviceOrientation getDeviceOrientation(void);
|
|
||||||
void setDeviceOrientation(ccDeviceOrientation kDeviceOrientation);
|
|
||||||
|
|
||||||
void setContentScaleFactor(CGFloat scaleFactor);
|
|
||||||
CGFloat getContentScaleFactor(void);
|
|
||||||
|
|
||||||
bool enableRetinaDisplay(bool enabled);
|
|
||||||
bool isRetinaDisplay() { return m_bRetinaDisplay; }
|
|
||||||
|
|
||||||
static bool setDirectorType(ccDirectorType obDirectorType);
|
|
||||||
|
|
||||||
static CCDirector* sharedDirector(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
class CCDisplayLinkDirector : public CCDirector
|
|
||||||
{
|
|
||||||
|
|
||||||
CCDisplayLinkDirector(void);
|
|
||||||
void mainLoop(void);
|
|
||||||
void setAnimationInterval(double dValue);
|
|
||||||
void startAnimation(void);
|
|
||||||
void stopAnimation();
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
int getDeviceOrientation();
|
||||||
|
|
||||||
|
static CCDirector* sharedDirector(void);
|
||||||
|
};
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
|
|
||||||
#include "CCGeometry.h" // for CCPoint
|
void ccDrawPoint(CCPoint point);
|
||||||
namespace cocos2d {
|
void ccDrawPoints(const CCPoint *points, unsigned int numberOfPoints);
|
||||||
|
void ccDrawLine(CCPoint origin, CCPoint destination);
|
||||||
/** draws a point given x and y coordinate measured in points */
|
void ccDrawPoly(const CCPoint *vertices, int numOfVertices, bool closePolygon);
|
||||||
void ccDrawPoint( CCPoint point );
|
void ccDrawCircle(CCPoint center, float radius, float angle, int segments, bool drawLineToCenter);
|
||||||
void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints );
|
|
||||||
void ccDrawLine( CCPoint origin, CCPoint destination );
|
|
||||||
void ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon );
|
|
||||||
void ccDrawCircle( CCPoint center, float radius, float angle, int segments, bool drawLineToCenter);
|
|
||||||
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments);
|
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments);
|
||||||
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments);
|
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments);
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#include "../platform/CCEGLView_platform.h"
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
class CCFileUtils
|
||||||
|
{
|
||||||
|
static std::string getWriteablePath();
|
||||||
|
};
|
|
@ -1 +0,0 @@
|
||||||
#include "platform/CCGL.h"
|
|
|
@ -1,81 +1,44 @@
|
||||||
|
|
||||||
#include "CCCommon.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef float CGFloat;
|
typedef float CGFloat;
|
||||||
|
|
||||||
class CCPoint
|
class CCPoint
|
||||||
{
|
{
|
||||||
public:
|
float x;
|
||||||
float x;
|
float y;
|
||||||
float y;
|
CCPoint();
|
||||||
public:
|
CCPoint(float x, float y);
|
||||||
CCPoint();
|
|
||||||
CCPoint(float x, float y);
|
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
||||||
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSize
|
class CCSize
|
||||||
{
|
{
|
||||||
public:
|
float width;
|
||||||
float width;
|
float height;
|
||||||
float height;
|
CCSize();
|
||||||
|
CCSize(float width, float height);
|
||||||
|
|
||||||
public:
|
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
||||||
CCSize();
|
|
||||||
CCSize(float width, float height);
|
|
||||||
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRect
|
class CCRect
|
||||||
{
|
{
|
||||||
public:
|
CCPoint origin;
|
||||||
CCPoint origin;
|
CCSize size;
|
||||||
CCSize size;
|
CCRect();
|
||||||
|
CCRect(float x, float y, float width, float height);
|
||||||
public:
|
|
||||||
CCRect();
|
|
||||||
CCRect(float x, float y, float width, float height);
|
|
||||||
|
|
||||||
public:
|
|
||||||
//! return the leftmost x-value of 'rect'
|
|
||||||
static CGFloat CCRectGetMinX(const CCRect& rect);
|
|
||||||
|
|
||||||
//! return the rightmost x-value of 'rect'
|
|
||||||
static CGFloat CCRectGetMaxX(const CCRect& rect);
|
|
||||||
|
|
||||||
//! return the midpoint x-value of 'rect'
|
|
||||||
static CGFloat CCRectGetMidX(const CCRect& rect);
|
|
||||||
|
|
||||||
//! Return the bottommost y-value of `rect'
|
|
||||||
static CGFloat CCRectGetMinY(const CCRect& rect);
|
|
||||||
|
|
||||||
//! Return the topmost y-value of `rect'
|
|
||||||
static CGFloat CCRectGetMaxY(const CCRect& rect);
|
|
||||||
|
|
||||||
//! Return the midpoint y-value of `rect'
|
|
||||||
static CGFloat CCRectGetMidY(const CCRect& rect);
|
|
||||||
|
|
||||||
static bool CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2);
|
|
||||||
|
|
||||||
|
static CGFloat CCRectGetMinX(const CCRect& rect);
|
||||||
|
static CGFloat CCRectGetMaxX(const CCRect& rect);
|
||||||
|
static CGFloat CCRectGetMidX(const CCRect& rect);
|
||||||
|
static CGFloat CCRectGetMinY(const CCRect& rect);
|
||||||
|
static CGFloat CCRectGetMaxY(const CCRect& rect);
|
||||||
|
static CGFloat CCRectGetMidY(const CCRect& rect);
|
||||||
|
static bool CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2);
|
||||||
static bool CCRectContainsPoint(const CCRect& rect, const CCPoint& point);
|
static bool CCRectContainsPoint(const CCRect& rect, const CCPoint& point);
|
||||||
|
static bool CCRectIntersectsRect(const CCRect& rectA, const CCRect& rectB);
|
||||||
static bool CCRectIntersectsRect(const CCRect& rectA, const CCRect& rectB);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
#define CCPointMake(x, y) CCPoint((x), (y))
|
|
||||||
#define CCSizeMake(width, height) CCSize((width), (height))
|
|
||||||
#define CCRectMake(x, y, width, height) CCRect((x), (y), (width), (height))
|
|
||||||
*/
|
|
||||||
CCPoint CCPointMake(float x, float y);
|
CCPoint CCPointMake(float x, float y);
|
||||||
CCSize CCSizeMake(float width, float height);
|
CCSize CCSizeMake(float width, float height);
|
||||||
CCRect CCRectMake(float x, float y, float width,float height);
|
CCRect CCRectMake(float x, float y, float width,float height);
|
||||||
/*
|
|
||||||
const CCPoint CCPointZero;
|
|
||||||
const CCSize CCSizeZero;
|
|
||||||
const CCRect CCRectZero;
|
|
||||||
*/
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
CCRect begin; // the soft keyboard rectangle when animatin begin
|
|
||||||
CCRect end; // the soft keyboard rectangle when animatin end
|
|
||||||
float duration; // the soft keyboard animation duration
|
|
||||||
} CCIMEKeyboardNotificationInfo;
|
|
||||||
|
|
||||||
class CCIMEDelegate
|
|
||||||
{
|
|
||||||
bool attachWithIME();
|
|
||||||
bool detachWithIME();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
class CCIMEDispatcher
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
static CCIMEDispatcher* sharedDispatcher();
|
|
||||||
void dispatchInsertText(const char * pText, int nLen);
|
|
||||||
void dispatchDeleteBackward();
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// dispatch keyboard notification
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
void dispatchKeyboardWillShow(CCIMEKeyboardNotificationInfo& info);
|
|
||||||
void dispatchKeyboardDidShow(CCIMEKeyboardNotificationInfo& info);
|
|
||||||
void dispatchKeyboardWillHide(CCIMEKeyboardNotificationInfo& info);
|
|
||||||
void dispatchKeyboardDidHide(CCIMEKeyboardNotificationInfo& info);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCKeypadDelegate
|
|
||||||
{
|
|
||||||
|
|
||||||
// The back key clicked
|
|
||||||
void keyBackClicked();
|
|
||||||
|
|
||||||
// The menu key clicked. only avialble on wophone & android
|
|
||||||
void keyMenuClicked();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCKeypadHandler : public CCObject
|
|
||||||
{
|
|
||||||
|
|
||||||
CCKeypadDelegate* getDelegate();
|
|
||||||
void setDelegate(CCKeypadDelegate *pDelegate);
|
|
||||||
bool initWithDelegate(CCKeypadDelegate *pDelegate);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} //namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
|
|
||||||
#include "CCKeypadDelegate.h"
|
|
||||||
#include "CCMutableArray.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
// the back key clicked msg
|
|
||||||
kTypeBackClicked = 1,
|
|
||||||
kTypeMenuClicked,
|
|
||||||
} ccKeypadMSGType;
|
|
||||||
class CCKeypadDispatcher : public CCObject
|
|
||||||
{
|
|
||||||
|
|
||||||
CCKeypadDispatcher();
|
|
||||||
|
|
||||||
static CCKeypadDispatcher* sharedDispatcher();
|
|
||||||
static void purgeSharedDispatcher();
|
|
||||||
|
|
||||||
void addDelegate(CCKeypadDelegate* pDelegate);
|
|
||||||
|
|
||||||
void removeDelegate(CCKeypadDelegate* pDelegate);
|
|
||||||
|
|
||||||
void forceAddDelegate(CCKeypadDelegate* pDelegate);
|
|
||||||
|
|
||||||
|
|
||||||
void forceRemoveDelegate(CCKeypadDelegate* pDelegate);
|
|
||||||
|
|
||||||
|
|
||||||
bool dispatchKeypadMSG(ccKeypadMSGType nMsgType);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace cocos2d
|
|
||||||
|
|
|
@ -1,34 +1,14 @@
|
||||||
#include "CCAtlasNode.h"
|
|
||||||
namespace cocos2d{
|
|
||||||
|
|
||||||
|
class CCLabelAtlas : public CCAtlasNode
|
||||||
class CCLabelAtlas : public CCAtlasNode, public CCLabelProtocol
|
{
|
||||||
{
|
void updateAtlasValues();
|
||||||
public:
|
|
||||||
CCLabelAtlas();
|
|
||||||
|
|
||||||
/** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
|
|
||||||
static CCLabelAtlas * labelWithString(const char *label, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
|
||||||
|
|
||||||
/** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
|
void setString(const char *label);
|
||||||
bool initWithString(const char *label, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
const char* getString(void);
|
||||||
// super methods
|
|
||||||
void updateAtlasValues();
|
|
||||||
void setString(const char *label);
|
|
||||||
const char* getString(void);
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
|
CCTexture2D* getTexture(void);
|
||||||
|
void setTexture(CCTexture2D *texture);
|
||||||
|
|
||||||
static CCAtlasNode * atlasWithTileFile(const char* tile,int tileWidth, int tileHeight, int itemsToRender);
|
static CCLabelAtlas * labelWithString(const char *label, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
||||||
|
static CCAtlasNode * atlasWithTileFile(const char* tile,int tileWidth, int tileHeight, int itemsToRender);
|
||||||
/** initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
};
|
||||||
bool initWithTileFile(const char* tile, int tileWidth, int tileHeight, int itemsToRender);
|
|
||||||
|
|
||||||
void updateAtlasValues();
|
|
||||||
|
|
||||||
void draw();
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
void setTexture(CCTexture2D *texture);
|
|
||||||
};
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,65 +1,17 @@
|
||||||
|
|
||||||
#include "CCSpriteBatchNode.h"
|
class CCLabelBMFont : public CCNode
|
||||||
namespace cocos2d{
|
{
|
||||||
|
void setString(const char *label);
|
||||||
|
const char* getString(void);
|
||||||
|
|
||||||
struct _KerningHashElement;
|
void setColor(const ccColor3B& color);
|
||||||
|
const ccColor3B& getColor(void);
|
||||||
|
|
||||||
|
GLubyte getOpacity(void);
|
||||||
|
void setOpacity(GLubyte opacity);
|
||||||
|
|
||||||
typedef struct _BMFontDef {
|
tolua_property__CCOpacity GLubyte opacity;
|
||||||
|
|
||||||
unsigned int charID;
|
|
||||||
|
|
||||||
CCRect rect;
|
|
||||||
|
|
||||||
int xOffset;
|
|
||||||
//! The Y amount the image should be offset when drawing the image (in pixels)
|
|
||||||
int yOffset;
|
|
||||||
//! The amount to move the current position after drawing the character (in pixels)
|
|
||||||
int xAdvance;
|
|
||||||
} ccBMFontDef;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _BMFontPadding {
|
|
||||||
/// padding left
|
|
||||||
int left;
|
|
||||||
/// padding top
|
|
||||||
int top;
|
|
||||||
/// padding right
|
|
||||||
int right;
|
|
||||||
/// padding bottom
|
|
||||||
int bottom;
|
|
||||||
} ccBMFontPadding;
|
|
||||||
|
|
||||||
|
|
||||||
class CCBMFontConfiguration : public CCObject
|
|
||||||
{
|
|
||||||
CCBMFontConfiguration();
|
|
||||||
char * description();
|
|
||||||
static CCBMFontConfiguration * configurationWithFNTFile(const char *FNTfile);
|
|
||||||
bool initWithFNTfile(const char *FNTfile);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCLabelBMFont : public CCSpriteBatchNode, public CCLabelProtocol, public CCRGBAProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
CCLabelBMFont();
|
|
||||||
static void purgeCachedData();
|
|
||||||
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
|
|
||||||
bool initWithString(const char *str, const char *fntFile);
|
|
||||||
void createFontChars();
|
|
||||||
void setString(const char *label);
|
|
||||||
const char* getString(void);
|
|
||||||
void setCString(const char *label);
|
|
||||||
void setAnchorPoint(CCPoint var);
|
|
||||||
void draw();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
CCBMFontConfiguration * FNTConfigLoadFile( const char *file );
|
|
||||||
|
|
||||||
void FNTConfigRemoveCache( void );
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
static void purgeCachedData();
|
||||||
|
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
|
||||||
|
};
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
|
|
||||||
#include "CCSprite.h"
|
class CCLabelTTF : public CCSprite
|
||||||
#include "CCTexture2D.h"
|
{
|
||||||
|
void setString(const char *label);
|
||||||
namespace cocos2d{
|
const char* getString(void);
|
||||||
class CCLabelTTF : public CCSprite, public CCLabelProtocol
|
|
||||||
{
|
|
||||||
CCLabelTTF();
|
|
||||||
~CCLabelTTF();
|
|
||||||
char * description();
|
|
||||||
|
|
||||||
static CCLabelTTF * labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
static CCLabelTTF * labelWithString(const char *label, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
bool initWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
bool initWithString(const char *label, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
|
|
||||||
void setString(const char *label);
|
|
||||||
const char* getString(void);
|
|
||||||
|
|
||||||
CCLabelProtocol* convertToLabelProtocol();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} //namespace cocos2d
|
|
||||||
|
|
||||||
|
static CCLabelTTF * labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
||||||
|
static CCLabelTTF * labelWithString(const char *label, const char *fontName, float fontSize);
|
||||||
|
};
|
||||||
|
|
|
@ -1,117 +1,66 @@
|
||||||
#include "CCNode.h"
|
|
||||||
#include "CCProtocols.h"
|
|
||||||
#include "CCTouchDelegateProtocol.h"
|
|
||||||
#include "CCAccelerometerDelegate.h"
|
|
||||||
#include "CCKeypadDelegate.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
class CCLayer : public CCNode
|
||||||
|
{
|
||||||
|
void setIsTouchEnabled(bool bValue);
|
||||||
|
bool getIsTouchEnabled();
|
||||||
|
|
||||||
class CCLayer : public CCNode, public CCTouchDelegate, public CCAccelerometerDelegate, public CCKeypadDelegate
|
void setIsAccelerometerEnabled(bool bValue);
|
||||||
{
|
bool getIsAccelerometerEnabled();
|
||||||
public:
|
|
||||||
CCLayer();
|
|
||||||
bool init();
|
|
||||||
static CCLayer *node(void);
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
void onEnterTransitionDidFinish();
|
|
||||||
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
|
|
||||||
void didAccelerate(CCAcceleration* pAccelerationValue) {}
|
void setIsKeypadEnabled(bool bValue);
|
||||||
|
bool getIsKeypadEnabled();
|
||||||
|
|
||||||
void registerWithTouchDispatcher(void);
|
void registerScriptTouchHandler(LUA_FUNCTION funcID,
|
||||||
|
bool isMultiTouches = false,
|
||||||
|
int nPriority = 0,
|
||||||
|
bool bSwallowsTouches = false);
|
||||||
|
void unregisterScriptTouchHandler();
|
||||||
|
|
||||||
void setIsTouchEnabled(bool bValue);
|
static CCLayer *node(void);
|
||||||
bool getIsTouchEnabled();
|
};
|
||||||
|
|
||||||
void setIsAccelerometerEnabled(bool bValue);
|
class CCLayerColor : public CCLayer
|
||||||
bool getIsAccelerometerEnabled();
|
{
|
||||||
|
void changeWidth(GLfloat w);
|
||||||
|
void changeHeight(GLfloat h);
|
||||||
|
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
||||||
|
|
||||||
void setIsKeypadEnabled(bool bValue);
|
void setOpacity(GLubyte var);
|
||||||
bool getIsKeypadEnabled();
|
GLubyte getOpacity(void);
|
||||||
|
void setColor(ccColor3B Value);
|
||||||
void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
ccColor3B getColor(void);
|
||||||
void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
void setBlendFunc(ccBlendFunc Value);
|
||||||
void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
ccBlendFunc getBlendFunc(void);
|
||||||
void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol
|
static CCLayerColor * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||||
{
|
static CCLayerColor * layerWithColor(ccColor4B color);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCLayerGradient : public CCLayerColor
|
||||||
|
{
|
||||||
|
void setStartColor(ccColor3B colors);
|
||||||
|
ccColor3B getStartColor();
|
||||||
|
void setEndColor(ccColor3B Value);
|
||||||
|
ccColor3B getEndColor(void);
|
||||||
|
void setStartOpacity(GLubyte Value);
|
||||||
|
GLubyte getStartOpacity(void);
|
||||||
|
void setEndOpacity(GLubyte Value);
|
||||||
|
GLubyte getEndOpacity(void);
|
||||||
|
void setVector(CCPoint Value);
|
||||||
|
CCPoint getVector(void);
|
||||||
|
|
||||||
|
void setIsCompressedInterpolation(bool Value);
|
||||||
|
bool getIsCompressedInterpolation(void);
|
||||||
|
|
||||||
CCLayerColor();
|
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end);
|
||||||
void draw();
|
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end, CCPoint v);
|
||||||
void setContentSize(CCSize var);
|
};
|
||||||
static CCLayerColor * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
|
||||||
static CCLayerColor * layerWithColor(ccColor4B color);
|
|
||||||
bool initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
|
||||||
bool initWithColor(ccColor4B color);
|
|
||||||
void changeWidth(GLfloat w);
|
|
||||||
void changeHeight(GLfloat h);
|
|
||||||
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
|
||||||
|
|
||||||
|
class CCLayerMultiplex : public CCLayer
|
||||||
|
{
|
||||||
|
void addLayer(CCLayer* layer);
|
||||||
|
void switchTo(unsigned int n);
|
||||||
|
void switchToAndReleaseMe(unsigned int n);
|
||||||
|
|
||||||
GLubyte getOpacity(void);
|
static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
|
||||||
void setOpacity(GLubyte var);
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setColor(ccColor3B Value);
|
|
||||||
ccColor3B getColor(void);
|
|
||||||
|
|
||||||
void setBlendFunc(ccBlendFunc Value);
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCLayerGradient : public CCLayerColor
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
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, CCPoint v);
|
|
||||||
|
|
||||||
/** Initializes the CCLayer with a gradient between start and end. */
|
|
||||||
bool initWithColor(ccColor4B start, ccColor4B end);
|
|
||||||
|
|
||||||
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */
|
|
||||||
bool initWithColor(ccColor4B start, ccColor4B end, CCPoint v);
|
|
||||||
|
|
||||||
ccColor3B getStartColor();
|
|
||||||
void setStartColor(ccColor3B colors);
|
|
||||||
|
|
||||||
void setEndColor(ccColor3B Value);
|
|
||||||
ccColor3B getEndColor(void);
|
|
||||||
|
|
||||||
void setStartOpacity(GLubyte Value);
|
|
||||||
GLubyte getStartOpacity(void);
|
|
||||||
|
|
||||||
void setEndOpacity(GLubyte Value);
|
|
||||||
GLubyte getEndOpacity(void);
|
|
||||||
|
|
||||||
void setVector(CCPoint Value);
|
|
||||||
CCPoint getVector(void);
|
|
||||||
|
|
||||||
void setIsCompressedInterpolation(bool Value);
|
|
||||||
bool getIsCompressedInterpolation(void);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCLayerMultiplex : public CCLayer
|
|
||||||
{
|
|
||||||
CCLayerMultiplex();
|
|
||||||
//static CCLayerMultiplex * layerWithLayers(CCLayer* layer, ... );
|
|
||||||
//lua instead with follow func
|
|
||||||
static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
|
|
||||||
void addLayer(CCLayer* layer);
|
|
||||||
bool initWithLayer(CCLayer* layer);
|
|
||||||
bool initWithLayers(CCLayer* layer, va_list params);
|
|
||||||
void switchTo(unsigned int n);
|
|
||||||
void switchToAndReleaseMe(unsigned int n);
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
|
@ -1,77 +1,24 @@
|
||||||
|
|
||||||
#include "CCMenuItem.h"
|
enum {
|
||||||
#include "CCLayer.h"
|
//* priority used by the menu
|
||||||
|
kCCMenuTouchPriority = -128,
|
||||||
|
};
|
||||||
|
|
||||||
namespace cocos2d{
|
class CCMenu : public CCLayer
|
||||||
|
{
|
||||||
|
void alignItemsVertically();
|
||||||
|
void alignItemsVerticallyWithPadding(float padding);
|
||||||
|
void alignItemsHorizontally();
|
||||||
|
void alignItemsHorizontallyWithPadding(float padding);
|
||||||
|
void alignItemsInColumns(unsigned int columns, va_list args);
|
||||||
|
void alignItemsInRows(unsigned int rows, va_list args);
|
||||||
|
|
||||||
typedef enum
|
void addChild(CCMenuItem* child, int zOrder = 0, int tag = -1);
|
||||||
{
|
|
||||||
kCCMenuStateWaiting,
|
|
||||||
kCCMenuStateTrackingTouch
|
|
||||||
} tCCMenuState;
|
|
||||||
|
|
||||||
enum {
|
void setOpacity(GLubyte opacity);
|
||||||
//* priority used by the menu
|
GLubyte getOpacity(void);
|
||||||
kCCMenuTouchPriority = -128,
|
void setColor(ccColor3B color);
|
||||||
};
|
ccColor3B getColor(void);
|
||||||
|
|
||||||
class CCMenu : public CCLayer, public CCRGBAProtocol
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCMenu();
|
|
||||||
virtual ~CCMenu(){}
|
|
||||||
static CCMenu*menuWithItem(CCMenuItem* item);
|
|
||||||
bool initWithItems(CCMenuItem* item, va_list args);
|
|
||||||
void alignItemsVertically();
|
|
||||||
|
|
||||||
void alignItemsVerticallyWithPadding(float padding);
|
|
||||||
void alignItemsHorizontally();
|
|
||||||
void alignItemsHorizontallyWithPadding(float padding);
|
|
||||||
|
|
||||||
|
|
||||||
// void alignItemsInRows(unsigned int rows, ...);
|
|
||||||
void alignItemsInColumns(unsigned int columns, va_list args);
|
|
||||||
|
|
||||||
/** align items in columns of rows */
|
|
||||||
// void alignItemsInColumns(unsigned int columns, ...);
|
|
||||||
void alignItemsInRows(unsigned int rows, va_list args);
|
|
||||||
|
|
||||||
//super methods
|
|
||||||
void addChild(CCNode * child, int zOrder);
|
|
||||||
void addChild(CCNode * child, int zOrder, int tag);
|
|
||||||
void registerWithTouchDispatcher();
|
|
||||||
bool ccTouchBegan(CCTouch* touch, CCEvent* event);
|
|
||||||
void ccTouchEnded(CCTouch* touch, CCEvent* event);
|
|
||||||
void ccTouchCancelled(CCTouch *touch, CCEvent* event);
|
|
||||||
void ccTouchMoved(CCTouch* touch, CCEvent* event);
|
|
||||||
|
|
||||||
|
|
||||||
void onExit();
|
|
||||||
|
|
||||||
void setOpacity(GLubyte opacity);
|
|
||||||
GLubyte getOpacity(void);
|
|
||||||
ccColor3B getColor(void);
|
|
||||||
void setColor(ccColor3B color);
|
|
||||||
|
|
||||||
static CCLayer *node(void);
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
void onEnterTransitionDidFinish();
|
|
||||||
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
|
|
||||||
void didAccelerate(CCAcceleration* pAccelerationValue) {}
|
|
||||||
|
|
||||||
void registerWithTouchDispatcher(void);
|
|
||||||
|
|
||||||
void setIsTouchEnabled(bool bValue);
|
|
||||||
bool getIsTouchEnabled();
|
|
||||||
|
|
||||||
void setIsAccelerometerEnabled(bool bValue);
|
|
||||||
bool getIsAccelerometerEnabled();
|
|
||||||
|
|
||||||
void setIsKeypadEnabled(bool bValue);
|
|
||||||
bool getIsKeypadEnabled();
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static CCMenu* node();
|
||||||
|
};
|
||||||
|
|
|
@ -1,138 +1,81 @@
|
||||||
#include "CCNode.h"
|
|
||||||
#include "CCProtocols.h"
|
|
||||||
|
|
||||||
namespace cocos2d{
|
class CCMenuItem : public CCNode
|
||||||
|
{
|
||||||
|
CCRect rect();
|
||||||
|
void activate();
|
||||||
|
void selected();
|
||||||
|
void unselected();
|
||||||
|
void setIsEnabled(bool enabled);
|
||||||
|
bool getIsEnabled();
|
||||||
|
bool getIsSelected();
|
||||||
|
|
||||||
class CCLabelTTF;
|
tolua_property__CCIsEnabled bool isEnabled;
|
||||||
class CCLabelAtlas;
|
|
||||||
class CCSprite;
|
|
||||||
|
|
||||||
|
void registerScriptHandler(LUA_FUNCTION funcID);
|
||||||
|
};
|
||||||
|
|
||||||
class CCMenuItem : public CCNode
|
class CCMenuItemLabel : public CCMenuItem
|
||||||
{
|
{
|
||||||
|
void setString(const char* label);
|
||||||
|
|
||||||
public:
|
void setOpacity(GLubyte opacity);
|
||||||
CCMenuItem();
|
GLubyte getOpacity();
|
||||||
|
void setColor(ccColor3B color);
|
||||||
|
ccColor3B getColor();
|
||||||
|
|
||||||
static CCMenuItem * itemWithTarget(CCObject *rec, SEL_MenuHandler selector);
|
static CCMenuItemLabel* itemWithLabel(CCNode* label);
|
||||||
bool initWithTarget(CCObject *rec, SEL_MenuHandler selector);
|
};
|
||||||
|
|
||||||
CCRect rect();
|
class CCMenuItemAtlasFont : public CCMenuItem
|
||||||
void activate();
|
{
|
||||||
void selected();
|
static CCMenuItemAtlasFont* itemFromString(const char* value,
|
||||||
void unselected();
|
const char* charMapFile,
|
||||||
|
int itemWidth,
|
||||||
void registerScriptHandler(const char* pszFunctionName);
|
int itemHeight,
|
||||||
|
char startCharMap);
|
||||||
|
};
|
||||||
|
|
||||||
};
|
class CCMenuItemFont : public CCMenuItem
|
||||||
|
{
|
||||||
|
static void setFontSize(int s);
|
||||||
|
static int fontSize();
|
||||||
|
static void setFontName(const char* name);
|
||||||
|
static const char* fontName();
|
||||||
|
static CCMenuItemFont * itemFromString(const char* value);
|
||||||
|
};
|
||||||
|
|
||||||
class CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol
|
class CCMenuItemSprite : public CCMenuItem
|
||||||
{
|
{
|
||||||
|
void setColor(ccColor3B color);
|
||||||
|
ccColor3B getColor();
|
||||||
|
void setOpacity(GLubyte opacity);
|
||||||
|
GLubyte getOpacity();
|
||||||
|
|
||||||
public:
|
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite,
|
||||||
CCMenuItemLabel();
|
CCNode* selectedSprite);
|
||||||
|
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite,
|
||||||
|
CCNode* selectedSprite,
|
||||||
|
CCNode* disabledSprite);
|
||||||
|
};
|
||||||
|
|
||||||
static CCMenuItemLabel * itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector);
|
class CCMenuItemImage : public CCMenuItem
|
||||||
static CCMenuItemLabel* itemWithLabel(CCNode *label);
|
{
|
||||||
|
void setColor(ccColor3B color);
|
||||||
|
ccColor3B getColor();
|
||||||
|
void setOpacity(GLubyte opacity);
|
||||||
|
GLubyte getOpacity();
|
||||||
|
|
||||||
bool initWithLabel(CCNode* label, CCObject* target, SEL_MenuHandler selector);
|
static CCMenuItemImage* itemFromNormalImage(const char* normalImage,
|
||||||
|
const char* selectedImage);
|
||||||
|
static CCMenuItemImage* itemFromNormalImage(const char* normalImage,
|
||||||
|
const char* selectedImage,
|
||||||
|
const char* disabledImage);
|
||||||
|
};
|
||||||
|
|
||||||
void setString(const char * label);
|
class CCMenuItemToggle : public CCMenuItem
|
||||||
|
{
|
||||||
virtual void activate();
|
void addSubItem(CCMenuItem *item);
|
||||||
virtual void selected();
|
CCMenuItem* selectedItem();
|
||||||
virtual void unselected();
|
|
||||||
virtual void setIsEnabled(bool enabled);
|
|
||||||
virtual void setOpacity(GLubyte opacity);
|
|
||||||
virtual GLubyte getOpacity();
|
|
||||||
virtual void setColor(ccColor3B color);
|
|
||||||
virtual ccColor3B getColor();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief A CCMenuItemAtlasFont
|
|
||||||
Helper class that creates a MenuItemLabel class with a LabelAtlas
|
|
||||||
*/
|
|
||||||
class CCMenuItemAtlasFont : public CCMenuItemLabel
|
|
||||||
{
|
|
||||||
|
|
||||||
CCMenuItemAtlasFont();
|
|
||||||
static CCMenuItemAtlasFont* itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
|
||||||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
|
||||||
static CCMenuItemAtlasFont* itemFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
/** initializes a menu item from a string and atlas with a target/selector */
|
|
||||||
bool initFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCMenuItemFont : public CCMenuItemLabel
|
|
||||||
{
|
|
||||||
|
|
||||||
CCMenuItemFont();
|
|
||||||
|
|
||||||
static void setFontSize(int s);
|
|
||||||
static int fontSize();
|
|
||||||
/** set the font name */
|
|
||||||
static void setFontName(const char *name);
|
|
||||||
/** get the font name */
|
|
||||||
static const char *fontName();
|
|
||||||
/** creates a menu item from a string without target/selector. To be used with CCMenuItemToggle */
|
|
||||||
static CCMenuItemFont * itemFromString(const char *value);
|
|
||||||
/** creates a menu item from a string with a target/selector */
|
|
||||||
static CCMenuItemFont * itemFromString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
/** initializes a menu item from a string with a target/selector */
|
|
||||||
bool initFromString(const char *value, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCMenuItemSprite : public CCMenuItem, public CCRGBAProtocol
|
|
||||||
{
|
|
||||||
CCMenuItemSprite();
|
|
||||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite);
|
|
||||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
void setColor(ccColor3B color);
|
|
||||||
ccColor3B getColor();
|
|
||||||
void setOpacity(GLubyte opacity);
|
|
||||||
GLubyte getOpacity();
|
|
||||||
void selected();
|
|
||||||
void unselected();
|
|
||||||
void setIsEnabled(bool bEnabled);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCMenuItemImage : public CCMenuItemSprite
|
|
||||||
{
|
|
||||||
|
|
||||||
CCMenuItemImage();
|
|
||||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage);
|
|
||||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage);
|
|
||||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
static CCMenuItemImage* itemFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
bool initFromNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
|
|
||||||
void setColor(ccColor3B color);
|
|
||||||
ccColor3B getColor();
|
|
||||||
void setOpacity(GLubyte opacity);
|
|
||||||
GLubyte getOpacity();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CCMenuItemToggle : public CCMenuItem, public CCRGBAProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
CCMenuItemToggle();
|
|
||||||
|
|
||||||
static CCMenuItemToggle* itemWithItem(CCMenuItem *item);
|
|
||||||
bool initWithItem(CCMenuItem *item);
|
|
||||||
void addSubItem(CCMenuItem *item);
|
|
||||||
|
|
||||||
CCMenuItem* selectedItem();
|
|
||||||
// super methods
|
|
||||||
virtual void activate();
|
|
||||||
virtual void selected();
|
|
||||||
virtual void unselected();
|
|
||||||
void setIsEnabled(bool var);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static CCMenuItemToggle* itemWithItem(CCMenuItem *item);
|
||||||
|
};
|
||||||
|
|
|
@ -1,29 +1,11 @@
|
||||||
|
|
||||||
#include "CCNode.h"
|
class CCMotionStreak : public CCNode
|
||||||
#include "CCProtocols.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCRibbon;
|
|
||||||
class CCMotionStreak : public CCNode, public CCTextureProtocol
|
|
||||||
{
|
{
|
||||||
|
CCRibbon* getRibbon(void);
|
||||||
// CC_PROPERTY_READONLY(CCRibbon*, m_pRibbon, Ribbon)
|
void setTexture(CCTexture2D* var);
|
||||||
CCRibbon* getRibbon(void);
|
CCTexture2D* getTexture(void);
|
||||||
|
|
||||||
//CC_PROPERTY(CCTexture2D*, m_pTexture, Texture)
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
void setTexture(CCTexture2D* var);
|
|
||||||
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
|
||||||
void setBlendFunc(ccBlendFunc var);
|
void setBlendFunc(ccBlendFunc var);
|
||||||
|
ccBlendFunc getBlendFunc(void);
|
||||||
|
|
||||||
CCMotionStreak();
|
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
|
||||||
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
|
|
||||||
bool initWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
|
|
||||||
void update(ccTime delta);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,38 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCMutableArray : public CCObject
|
class CCMutableArray : public CCObject
|
||||||
{
|
{
|
||||||
TOLUA_TEMPLATE_BIND(T, CCObject*, CCSpriteFrame*, CCFiniteTimeAction*)
|
TOLUA_TEMPLATE_BIND(T, CCObject*, CCSpriteFrame*, CCFiniteTimeAction*)
|
||||||
|
|
||||||
CCMutableArray(unsigned int uSize = 0);
|
unsigned int count(void);
|
||||||
|
unsigned int getIndexOfObject(T pObject);
|
||||||
|
|
||||||
~CCMutableArray(void);
|
bool containsObject(T pObject);
|
||||||
|
|
||||||
unsigned int count(void);
|
T getLastObject(void);
|
||||||
unsigned int getIndexOfObject(T pObject);
|
T getObjectAtIndex(unsigned int uIndex);
|
||||||
|
|
||||||
bool containsObject(T pObject);
|
void addObject(T pObject);
|
||||||
|
void addObjectsFromArray(CCMutableArray<T> *pArray);
|
||||||
T getLastObject(void);
|
|
||||||
T getObjectAtIndex(unsigned int uIndex);
|
|
||||||
|
|
||||||
// Adding objects
|
|
||||||
void addObject(T pObject);
|
|
||||||
void addObjectsFromArray(CCMutableArray<T> *pArray);
|
|
||||||
|
|
||||||
void insertObjectAtIndex(T pObject, unsigned int uIndex);
|
void insertObjectAtIndex(T pObject, unsigned int uIndex);
|
||||||
// Removing objects
|
void removeLastObject(bool bDeleteObject = true);
|
||||||
void removeLastObject(bool bDeleteObject = true);
|
|
||||||
|
|
||||||
void removeObject(T pObject, bool bDeleteObject = true);
|
void removeObject(T pObject, bool bDeleteObject = true);
|
||||||
|
|
||||||
void removeObjectsInArray(CCMutableArray<T>* pDeleteArray);
|
void removeObjectsInArray(CCMutableArray<T>* pDeleteArray);
|
||||||
|
|
||||||
void removeObjectAtIndex(unsigned int uIndex, bool bDeleteObject = true);
|
void removeObjectAtIndex(unsigned int uIndex, bool bDeleteObject = true);
|
||||||
void removeAllObjects(bool bDeleteObject = true);
|
void removeAllObjects(bool bDeleteObject = true);
|
||||||
|
|
||||||
void replaceObjectAtIndex(unsigned int uIndex, T pObject, bool bDeleteObject = true);
|
void replaceObjectAtIndex(unsigned int uIndex, T pObject, bool bDeleteObject = true);
|
||||||
|
|
||||||
|
std::vector<T>::iterator begin(void);
|
||||||
std::vector<T>::iterator begin(void);
|
|
||||||
|
|
||||||
std::vector<T>::reverse_iterator rbegin(void);
|
std::vector<T>::reverse_iterator rbegin(void);
|
||||||
|
|
||||||
std::vector<T>::iterator endToLua(void);
|
std::vector<T>::iterator endToLua(void);
|
||||||
std::vector<T>::reverse_iterator rend(void);
|
std::vector<T>::reverse_iterator rend(void);
|
||||||
CCMutableArray<T>* copy(void);
|
CCMutableArray<T>* copy(void);
|
||||||
|
|
||||||
//static CCMutableArray<T>* arrayWithObjects(T pObject1, ...);
|
|
||||||
|
|
||||||
static CCMutableArray<T>* arrayWithArray(CCMutableArray<T> *pArray);
|
|
||||||
|
|
||||||
|
static CCMutableArray<T>* arrayWithArray(CCMutableArray<T> *pArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,26 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCMutableDictionary : public CCObject
|
class CCMutableDictionary : public CCObject
|
||||||
{
|
{
|
||||||
TOLUA_TEMPLATE_BIND(K V, std::string CCObject*)
|
TOLUA_TEMPLATE_BIND(K V, std::string CCObject*)
|
||||||
|
|
||||||
CCMutableDictionary(void);
|
unsigned int count();
|
||||||
~CCMutableDictionary(void);
|
std::vector<std::string> allKeys();
|
||||||
/// return the number of items
|
std::vector<std::string> allKeysForObject(V object);
|
||||||
unsigned int count();
|
|
||||||
/// return all the keys
|
|
||||||
std::vector<std::string> allKeys();
|
|
||||||
|
|
||||||
/** @warning : We use '==' to compare two objects*/
|
V objectForKey(K key);
|
||||||
std::vector<std::string> allKeysForObject(V object);
|
|
||||||
|
|
||||||
V objectForKey(K key); ///<
|
bool setObject(V pObject, K key);
|
||||||
|
void removeObjectForKey(K key);
|
||||||
|
bool begin();
|
||||||
|
void endToLua();
|
||||||
|
|
||||||
bool setObject(V pObject, K key);
|
V next(K* key = NULL);
|
||||||
void removeObjectForKey(K key);
|
|
||||||
bool begin();
|
|
||||||
|
|
||||||
V next(K* key = NULL);
|
void endToLua();
|
||||||
|
|
||||||
void endToLua();
|
void removeAllObjects();
|
||||||
|
|
||||||
void removeAllObjects();
|
static CCMutableDictionary<K, V>* dictionaryWithDictionary(CCMutableDictionary<K, V>* srcDict);
|
||||||
static CCMutableDictionary<K, V>* dictionaryWithDictionary(CCMutableDictionary<K, V>* srcDict);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef CCMutableDictionary<std::string, CCString*> CCStringToStringDictionary;
|
typedef CCMutableDictionary<std::string, CCString*> CCStringToStringDictionary;
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,106 +1,114 @@
|
||||||
namespace cocos2d {
|
|
||||||
enum {
|
|
||||||
kCCNodeTagInvalid = -1,
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCNode : public CCObject
|
class CCNode : public CCObject
|
||||||
{
|
{
|
||||||
CCNode();
|
int getZOrder();
|
||||||
int getZOrder();
|
float getVertexZ();
|
||||||
float getVertexZ();
|
void setVertexZ(float var);
|
||||||
void setVertexZ(float var);
|
float getRotation();
|
||||||
float getRotation();
|
void setRotation(float newRotation);
|
||||||
void setRotation(float newRotation);
|
float getScale();
|
||||||
float getScale();
|
void setScale(float scale);
|
||||||
void setScale(float scale);
|
float getScaleX();
|
||||||
float getScaleX();
|
void setScaleX(float newScaleX);
|
||||||
void setScaleX(float newScaleX);
|
float getScaleY();
|
||||||
float getScaleY();
|
void setScaleY(float newScaleY);
|
||||||
void setScaleY(float newScaleY);
|
CCPoint getPositionLua();
|
||||||
CCPoint getPosition();
|
void getPosition(float* x = 0, float* y = 0);
|
||||||
void setPosition(CCPoint newPosition);
|
float getPositionX();
|
||||||
|
float getPositionY();
|
||||||
float getSkewX();
|
void setPosition(CCPoint newPosition);
|
||||||
void setSkewX(float skewX);
|
void setPosition(float x, float y);
|
||||||
float getSkewY();
|
void setPositionX(float x);
|
||||||
void setSkewY(float skewY);
|
void setPositionY(float y);
|
||||||
|
float getSkewX();
|
||||||
CCMutableArray<CCNode*> * getChildren();
|
void setSkewX(float skewX);
|
||||||
CCCamera* getCamera();
|
float getSkewY();
|
||||||
CCGridBase* getGrid();
|
void setSkewY(float skewY);
|
||||||
void setGrid(CCGridBase* pGrid);
|
bool getIsVisible();
|
||||||
bool getIsVisible();
|
void setIsVisible(bool var);
|
||||||
void setIsVisible(bool var);
|
CCPoint getAnchorPoint();
|
||||||
CCPoint getAnchorPoint();
|
void setAnchorPoint(CCPoint point);
|
||||||
void setAnchorPoint(CCPoint point);
|
CCSize getContentSize();
|
||||||
CCPoint getAnchorPointInPixels();
|
void setContentSize(CCSize size);
|
||||||
CCSize getContentSizeInPixels();
|
int getTag();
|
||||||
void setContentSizeInPixels(CCSize sz);
|
void setTag(int var);
|
||||||
CCSize getContentSize();
|
|
||||||
void setContentSize(CCSize size);
|
|
||||||
bool getIsRunning();
|
|
||||||
CCNode* getParent();
|
|
||||||
void setParent(CCNode * var);
|
|
||||||
bool getIsRelativeAnchorPoint();
|
|
||||||
void setIsRelativeAnchorPoint(bool newValue);
|
|
||||||
int getTag();
|
|
||||||
void setTag(int var);
|
|
||||||
void* getUserData();
|
|
||||||
void setUserData(void *var);
|
|
||||||
void onEnter();
|
|
||||||
void onEnterTransitionDidFinish();
|
|
||||||
void onExit();
|
|
||||||
void addChild(CCNode * child);
|
|
||||||
void addChild(CCNode * child, int zOrder);
|
|
||||||
void addChild(CCNode * child, int zOrder, int tag);
|
|
||||||
void removeChild(CCNode* child, bool cleanup);
|
|
||||||
void removeAllChildrenWithCleanup(bool cleanup);
|
|
||||||
void reorderChild(CCNode * child, int zOrder);
|
|
||||||
void cleanup(void);
|
|
||||||
void draw(void);
|
|
||||||
void visit(void);
|
|
||||||
void transform(void);
|
|
||||||
void transformAncestors(void);
|
|
||||||
CCRect boundingBox(void);
|
|
||||||
CCAction* runAction(CCAction* action);
|
|
||||||
void stopAllActions(void);
|
|
||||||
void stopAction(CCAction* action);
|
|
||||||
void stopActionByTag(int tag);
|
|
||||||
CCAction* getActionByTag(int tag);
|
|
||||||
char * description(void);
|
|
||||||
CCNode* getChildByTag(int tag);
|
|
||||||
unsigned int numberOfRunningActions(void);
|
|
||||||
//bool isScheduled(SEL_SCHEDULE selector);
|
|
||||||
void scheduleUpdate(void);
|
|
||||||
void scheduleUpdateWithPriority(int priority);
|
|
||||||
void unscheduleUpdate(void);
|
|
||||||
//void schedule(SEL_SCHEDULE selector);
|
|
||||||
//void schedule(SEL_SCHEDULE selector, ccTime interval);
|
|
||||||
//void unschedule(SEL_SCHEDULE selector);
|
|
||||||
|
|
||||||
void unscheduleAllSelectors(void);
|
|
||||||
void resumeSchedulerAndActions(void);
|
|
||||||
void pauseSchedulerAndActions(void);
|
|
||||||
CCAffineTransform nodeToParentTransform(void);
|
|
||||||
CCAffineTransform parentToNodeTransform(void);
|
|
||||||
CCAffineTransform nodeToWorldTransform(void);
|
|
||||||
CCAffineTransform worldToNodeTransform(void);
|
|
||||||
CCPoint convertToNodeSpace(CCPoint worldPoint);
|
|
||||||
CCPoint convertToWorldSpace(CCPoint nodePoint);
|
|
||||||
CCPoint convertToNodeSpaceAR(CCPoint worldPoint);
|
|
||||||
CCPoint convertToWorldSpaceAR(CCPoint nodePoint);
|
|
||||||
CCPoint convertTouchToNodeSpace(CCTouch * touch);
|
|
||||||
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
|
|
||||||
void removeFromParentAndCleanup(bool cleanup);
|
|
||||||
void removeChildByTag(int tag, bool cleanup);
|
|
||||||
|
|
||||||
static CCNode * node(void);
|
tolua_readonly tolua_property__CCZOrder int zOrder;
|
||||||
|
tolua_property__CCVertexZ float vertexZ;
|
||||||
|
tolua_property__CCRotation float rotation;
|
||||||
|
tolua_property__CCScale float scale;
|
||||||
|
tolua_property__CCScaleX float scaleX;
|
||||||
|
tolua_property__CCScaleY float scaleY;
|
||||||
|
tolua_property__CCPositionX float x;
|
||||||
|
tolua_property__CCPositionY float y;
|
||||||
|
tolua_property__CCSkewX float skewX;
|
||||||
|
tolua_property__CCSkewY float skewY;
|
||||||
|
tolua_property__CCIsVisible bool isVisible;
|
||||||
|
tolua_property__CCAnchorPoint CCPoint anchorPoint;
|
||||||
|
tolua_property__CCContentSize CCSize contentSize;
|
||||||
|
tolua_property__CCTag int tag;
|
||||||
|
|
||||||
|
CCMutableArray<CCNode*>* getChildren();
|
||||||
|
unsigned int getChildrenCount(void);
|
||||||
|
|
||||||
|
CCCamera* getCamera();
|
||||||
|
CCGridBase* getGrid();
|
||||||
|
void setGrid(CCGridBase* pGrid);
|
||||||
|
CCPoint getAnchorPointInPixels();
|
||||||
|
CCSize getContentSizeInPixels();
|
||||||
|
void setContentSizeInPixels(CCSize sz);
|
||||||
|
bool getIsRunning();
|
||||||
|
CCNode* getParent();
|
||||||
|
void setParent(CCNode * var);
|
||||||
|
bool getIsRelativeAnchorPoint();
|
||||||
|
void setIsRelativeAnchorPoint(bool newValue);
|
||||||
|
void* getUserData();
|
||||||
|
void setUserData(void *var);
|
||||||
|
void addChild(CCNode * child);
|
||||||
|
void addChild(CCNode * child, int zOrder);
|
||||||
|
void addChild(CCNode * child, int zOrder, int tag);
|
||||||
|
void removeChild(CCNode* child, bool cleanup);
|
||||||
|
void removeAllChildrenWithCleanup(bool cleanup);
|
||||||
|
void reorderChild(CCNode * child, int zOrder);
|
||||||
|
void cleanup(void);
|
||||||
|
void draw(void);
|
||||||
|
void visit(void);
|
||||||
|
void transform(void);
|
||||||
|
void transformAncestors(void);
|
||||||
|
CCRect boundingBox(void);
|
||||||
|
|
||||||
|
void runAction(CCAction* action);
|
||||||
|
void stopAllActions(void);
|
||||||
|
void stopAction(CCAction* action);
|
||||||
|
|
||||||
|
void stopActionByTag(int tag);
|
||||||
|
CCAction* getActionByTag(int tag);
|
||||||
|
char * description(void);
|
||||||
|
CCNode* getChildByTag(int tag);
|
||||||
|
|
||||||
|
unsigned int numberOfRunningActions(void);
|
||||||
|
|
||||||
|
void scheduleUpdate(void);
|
||||||
|
void scheduleUpdateWithPriority(int priority);
|
||||||
|
void unscheduleUpdate(void);
|
||||||
|
void unscheduleAllSelectors(void);
|
||||||
|
void resumeSchedulerAndActions(void);
|
||||||
|
void pauseSchedulerAndActions(void);
|
||||||
|
|
||||||
|
CCAffineTransform nodeToParentTransform(void);
|
||||||
|
CCAffineTransform parentToNodeTransform(void);
|
||||||
|
CCAffineTransform nodeToWorldTransform(void);
|
||||||
|
CCAffineTransform worldToNodeTransform(void);
|
||||||
|
|
||||||
|
CCPoint convertToNodeSpace(CCPoint worldPoint);
|
||||||
|
CCPoint convertToWorldSpace(CCPoint nodePoint);
|
||||||
|
CCPoint convertToNodeSpaceAR(CCPoint worldPoint);
|
||||||
|
CCPoint convertToWorldSpaceAR(CCPoint nodePoint);
|
||||||
|
CCPoint convertTouchToNodeSpace(CCTouch * touch);
|
||||||
|
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
|
||||||
|
|
||||||
|
void removeFromParentAndCleanup(bool cleanup);
|
||||||
|
void removeChildByTag(int tag, bool cleanup);
|
||||||
|
|
||||||
|
static CCNode * node(void);
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
#include "ccTypes.h"
|
|
||||||
|
|
||||||
namespace cocos2d {
|
class CCObject
|
||||||
|
|
||||||
class CCCopying
|
|
||||||
{
|
{
|
||||||
|
void release(void);
|
||||||
CCObject* copyWithZone(CCZone* pZone);
|
void retain(void);
|
||||||
|
bool isSingleRefrence(void);
|
||||||
|
unsigned int retainCount(void);
|
||||||
|
bool isEqual(const CCObject* pObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCObject : public CCCopying
|
|
||||||
{
|
|
||||||
|
|
||||||
CCObject(void);
|
|
||||||
~CCObject(void);
|
|
||||||
|
|
||||||
void release(void);
|
|
||||||
void retain(void);
|
|
||||||
CCObject* autorelease(void);
|
|
||||||
CCObject* copy(void);
|
|
||||||
bool isSingleRefrence(void);
|
|
||||||
unsigned int retainCount(void);
|
|
||||||
bool isEqual(const CCObject* pObject);
|
|
||||||
void update(ccTime dt);
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
namespace cocos2d {
|
|
||||||
struct _ccArray;
|
|
||||||
class CCParallaxNode : public CCNode
|
|
||||||
{
|
|
||||||
|
|
||||||
struct _ccArray * getParallaxArray();
|
|
||||||
void setParallaxArray(struct _ccArray * pval);
|
|
||||||
|
|
||||||
|
struct _ccArray;
|
||||||
|
|
||||||
CCParallaxNode();
|
class CCParallaxNode : public CCNode
|
||||||
~CCParallaxNode();
|
{
|
||||||
static CCParallaxNode * node();
|
struct _ccArray* getParallaxArray();
|
||||||
void addChild(CCNode * child, unsigned int z, CCPoint parallaxRatio, CCPoint positionOffset);
|
void setParallaxArray(struct _ccArray * pval);
|
||||||
void addChild(CCNode * child, unsigned int zOrder, int tag);
|
|
||||||
void removeChild(CCNode* child, bool cleanup);
|
|
||||||
void removeAllChildrenWithCleanup(bool cleanup);
|
|
||||||
void visit(void);
|
|
||||||
struct _ccArray * getParallaxArray();
|
|
||||||
void setParallaxArray(struct _ccArray * val);
|
|
||||||
|
|
||||||
};
|
void addChild(CCNode * child, unsigned int z, CCPoint parallaxRatio, CCPoint positionOffset);
|
||||||
|
void addChild(CCNode * child, unsigned int zOrder, int tag);
|
||||||
|
|
||||||
} // namespace cocos2d
|
void removeChild(CCNode* child, bool cleanup);
|
||||||
|
void removeAllChildrenWithCleanup(bool cleanup);
|
||||||
|
|
||||||
|
void visit(void);
|
||||||
|
|
||||||
|
struct _ccArray* getParallaxArray();
|
||||||
|
void setParallaxArray(struct _ccArray * val);
|
||||||
|
|
||||||
|
static CCParallaxNode* node();
|
||||||
|
};
|
||||||
|
|
|
@ -1,135 +1,58 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCParticleSystem : public CCNode, public CCTextureProtocol {
|
class CCParticleSystem : public CCNode
|
||||||
CCParticleSystem();
|
{
|
||||||
static CCParticleSystem * particleWithFile(const char *plistFile);
|
// mode A
|
||||||
bool initWithFile(const char *plistFile);
|
const CCPoint& getGravity();
|
||||||
bool initWithDictionary(CCDictionary<std::string, CCObject*> *dictionary);
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
|
|
||||||
// mode A
|
void setGravity(const CCPoint& g);
|
||||||
const CCPoint& getGravity();
|
float getSpeed();
|
||||||
void setGravity(const CCPoint& g);
|
void setSpeed(float speed);
|
||||||
float getSpeed();
|
float getSpeedVar();
|
||||||
void setSpeed(float speed);
|
void setSpeedVar(float speed);
|
||||||
float getSpeedVar();
|
float getTangentialAccel();
|
||||||
void setSpeedVar(float speed);
|
void setTangentialAccel(float t);
|
||||||
float getTangentialAccel();
|
float getTangentialAccelVar();
|
||||||
void setTangentialAccel(float t);
|
void setTangentialAccelVar(float t);
|
||||||
float getTangentialAccelVar();
|
float getRadialAccel();
|
||||||
void setTangentialAccelVar(float t);
|
void setRadialAccel(float t);
|
||||||
float getRadialAccel();
|
float getRadialAccelVar();
|
||||||
void setRadialAccel(float t);
|
void setRadialAccelVar(float t);
|
||||||
float getRadialAccelVar();
|
|
||||||
void setRadialAccelVar(float t);
|
|
||||||
// mode B
|
|
||||||
float getStartRadius();
|
|
||||||
void setStartRadius(float startRadius);
|
|
||||||
float getStartRadiusVar();
|
|
||||||
void setStartRadiusVar(float startRadiusVar);
|
|
||||||
float getEndRadius();
|
|
||||||
void setEndRadius(float endRadius);
|
|
||||||
float getEndRadiusVar();
|
|
||||||
void setEndRadiusVar(float endRadiusVar);
|
|
||||||
float getRotatePerSecond();
|
|
||||||
void setRotatePerSecond(float degrees);
|
|
||||||
float getRotatePerSecondVar();
|
|
||||||
void setRotatePerSecondVar(float degrees);
|
|
||||||
|
|
||||||
bool addParticle();
|
// mode B
|
||||||
void initParticle(tCCParticle* particle);
|
float getStartRadius();
|
||||||
void stopSystem();
|
void setStartRadius(float startRadius);
|
||||||
void resetSystem();
|
float getStartRadiusVar();
|
||||||
bool isFull();
|
void setStartRadiusVar(float startRadiusVar);
|
||||||
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
float getEndRadius();
|
||||||
void postStep();
|
void setEndRadius(float endRadius);
|
||||||
void update(ccTime dt);
|
float getEndRadiusVar();
|
||||||
|
void setEndRadiusVar(float endRadiusVar);
|
||||||
|
float getRotatePerSecond();
|
||||||
|
void setRotatePerSecond(float degrees);
|
||||||
|
float getRotatePerSecondVar();
|
||||||
|
void setRotatePerSecondVar(float degrees);
|
||||||
|
|
||||||
CCTexture2D* getTexture(void);
|
bool addParticle();
|
||||||
void setTexture(CCTexture2D* var);
|
void initParticle(tCCParticle* particle);
|
||||||
|
void stopSystem();
|
||||||
|
void resetSystem();
|
||||||
|
bool isFull();
|
||||||
|
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
||||||
|
void postStep();
|
||||||
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
CCTexture2D* getTexture(void);
|
||||||
void setBlendFunc(ccBlendFunc var);
|
void setTexture(CCTexture2D* var);
|
||||||
|
|
||||||
|
ccBlendFunc getBlendFunc(void);
|
||||||
|
void setBlendFunc(ccBlendFunc var);
|
||||||
|
|
||||||
|
static CCParticleSystem * particleWithFile(const char *plistFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCParticleSystemQuad : public CCParticleSystem {
|
class CCParticleSystemQuad : public CCParticleSystem {
|
||||||
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
|
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCParticleSystemPoint : public CCParticleSystem {
|
class CCParticleSystemPoint : public CCParticleSystem {
|
||||||
static CCParticleSystemPoint * particleWithFile(const char *plistFile);
|
static CCParticleSystemPoint * particleWithFile(const char *plistFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inheritance is funky here in the examples.... in reality its a pragma-def .. not sure how to map that?
|
|
||||||
|
|
||||||
class CCParticleFire : public CCParticleSystem {
|
|
||||||
CCParticleFire();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleFire *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleFireworks : public CCParticleSystem {
|
|
||||||
CCParticleFireworks();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleFireworks *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleSun : public CCParticleSystem {
|
|
||||||
CCParticleSun();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleSun *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleGalaxy : public CCParticleSystem {
|
|
||||||
CCParticleGalaxy();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleGalaxy *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleMeteor : public CCParticleSystem {
|
|
||||||
CCParticleMeteor();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleMeteor *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleSpiral : public CCParticleSystem {
|
|
||||||
CCParticleSpiral();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleSpiral *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleExplosion : public CCParticleSystem {
|
|
||||||
CCParticleExplosion();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleExplosion *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleSmoke : public CCParticleSystem {
|
|
||||||
CCParticleSmoke();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleSmoke *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleSnow : public CCParticleSystem {
|
|
||||||
CCParticleSnow();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleSnow *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCParticleRain : public CCParticleSystem {
|
|
||||||
CCParticleRain();
|
|
||||||
bool init();
|
|
||||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
static CCParticleRain *node(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
|
@ -1,71 +1,31 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
static CCPoint ccpNeg(const CCPoint& v);
|
static CCPoint ccpNeg(const CCPoint& v);
|
||||||
|
|
||||||
static CCPoint ccpAdd(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpAdd(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CCPoint ccpSub(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpSub(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CCPoint ccpMult(const CCPoint& v, const CGFloat s);
|
static CCPoint ccpMult(const CCPoint& v, const CGFloat s);
|
||||||
|
|
||||||
static CCPoint ccpMidpoint(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpMidpoint(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CGFloat ccpDot(const CCPoint& v1, const CCPoint& v2);
|
static CGFloat ccpDot(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
static CGFloat ccpCross(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CGFloat ccpCross(const CCPoint& v1, const CCPoint& v2);
|
|
||||||
|
|
||||||
static CCPoint ccpPerp(const CCPoint& v);
|
static CCPoint ccpPerp(const CCPoint& v);
|
||||||
|
|
||||||
static CCPoint ccpRPerp(const CCPoint& v);
|
static CCPoint ccpRPerp(const CCPoint& v);
|
||||||
|
|
||||||
static CCPoint ccpProject(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpProject(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CCPoint ccpRotate(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpRotate(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CCPoint ccpUnrotate(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpUnrotate(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
static CGFloat ccpLengthSQ(const CCPoint& v);
|
static CGFloat ccpLengthSQ(const CCPoint& v);
|
||||||
|
CGFloat ccpLength(const CCPoint& v);
|
||||||
CGFloat ccpLength(const CCPoint& v);
|
|
||||||
|
|
||||||
CGFloat ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
CGFloat ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
||||||
|
|
||||||
CCPoint ccpNormalize(const CCPoint& v);
|
CCPoint ccpNormalize(const CCPoint& v);
|
||||||
|
|
||||||
CCPoint ccpForAngle(const CGFloat a);
|
CCPoint ccpForAngle(const CGFloat a);
|
||||||
|
CGFloat ccpToAngle(const CCPoint& v);
|
||||||
CGFloat ccpToAngle(const CCPoint& v);
|
float clampf(float value, float min_inclusive, float max_inclusive);
|
||||||
|
CCPoint ccpClamp(const CCPoint& p, const CCPoint& from, const CCPoint& to);
|
||||||
float clampf(float value, float min_inclusive, float max_inclusive);
|
CCPoint ccpFromSize(const CCSize& s);
|
||||||
|
|
||||||
CCPoint ccpClamp(const CCPoint& p, const CCPoint& from, const CCPoint& to);
|
|
||||||
|
|
||||||
CCPoint ccpFromSize(const CCSize& s);
|
|
||||||
|
|
||||||
//CCPoint ccpCompOp(const CCPoint& p, float (*opFunc)(float));
|
|
||||||
|
|
||||||
CCPoint ccpLerp(const CCPoint& a, const CCPoint& b, float alpha);
|
CCPoint ccpLerp(const CCPoint& a, const CCPoint& b, float alpha);
|
||||||
|
|
||||||
|
|
||||||
bool ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float variance);
|
bool ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float variance);
|
||||||
|
|
||||||
|
|
||||||
CCPoint ccpCompMult(const CCPoint& a, const CCPoint& b);
|
CCPoint ccpCompMult(const CCPoint& a, const CCPoint& b);
|
||||||
|
|
||||||
float ccpAngleSigned(const CCPoint& a, const CCPoint& b);
|
float ccpAngleSigned(const CCPoint& a, const CCPoint& b);
|
||||||
|
|
||||||
float ccpAngle(const CCPoint& a, const CCPoint& b);
|
float ccpAngle(const CCPoint& a, const CCPoint& b);
|
||||||
|
|
||||||
CCPoint ccpRotateByAngle(const CCPoint& v, const CCPoint& pivot, float angle);
|
CCPoint ccpRotateByAngle(const CCPoint& v, const CCPoint& pivot, float angle);
|
||||||
|
|
||||||
bool ccpLineIntersect(const CCPoint& p1, const CCPoint& p2, const CCPoint& p3, const CCPoint& p4, float *s, float *t);
|
bool ccpLineIntersect(const CCPoint& p1, const CCPoint& p2, const CCPoint& p3, const CCPoint& p4, float *s, float *t);
|
||||||
|
|
||||||
bool ccpSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
bool ccpSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
||||||
|
|
||||||
CCPoint ccpIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
CCPoint ccpIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,29 @@
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/// Radial Counter-Clockwise
|
/// Radial Counter-Clockwise
|
||||||
kCCProgressTimerTypeRadialCCW,
|
kCCProgressTimerTypeRadialCCW,
|
||||||
/// Radial ClockWise
|
/// Radial ClockWise
|
||||||
kCCProgressTimerTypeRadialCW,
|
kCCProgressTimerTypeRadialCW,
|
||||||
/// Horizontal Left-Right
|
/// Horizontal Left-Right
|
||||||
kCCProgressTimerTypeHorizontalBarLR,
|
kCCProgressTimerTypeHorizontalBarLR,
|
||||||
/// Horizontal Right-Left
|
/// Horizontal Right-Left
|
||||||
kCCProgressTimerTypeHorizontalBarRL,
|
kCCProgressTimerTypeHorizontalBarRL,
|
||||||
/// Vertical Bottom-top
|
/// Vertical Bottom-top
|
||||||
kCCProgressTimerTypeVerticalBarBT,
|
kCCProgressTimerTypeVerticalBarBT,
|
||||||
/// Vertical Top-Bottom
|
/// Vertical Top-Bottom
|
||||||
kCCProgressTimerTypeVerticalBarTB,
|
kCCProgressTimerTypeVerticalBarTB,
|
||||||
} CCProgressTimerType;
|
} CCProgressTimerType;
|
||||||
|
|
||||||
|
class CCProgressTimer : public CCNode
|
||||||
class CCProgressTimer : public CCNode
|
|
||||||
{
|
{
|
||||||
|
CCProgressTimerType getType(void);
|
||||||
|
float getPercentage(void);
|
||||||
|
CCSprite* getSprite(void);
|
||||||
|
|
||||||
~CCProgressTimer(void);
|
void setPercentage(float fPercentage);
|
||||||
CCProgressTimerType getType(void);
|
void setSprite(CCSprite *pSprite);
|
||||||
float getPercentage(void);
|
void setType(CCProgressTimerType type);
|
||||||
|
|
||||||
/** The image to show the progress percentage, retain */
|
|
||||||
CCSprite* getSprite(void);
|
|
||||||
|
|
||||||
bool initWithFile(const char *pszFileName);
|
|
||||||
bool initWithTexture(CCTexture2D *pTexture);
|
|
||||||
|
|
||||||
void setPercentage(float fPercentage);
|
|
||||||
void setSprite(CCSprite *pSprite);
|
|
||||||
void setType(CCProgressTimerType type);
|
|
||||||
|
|
||||||
void draw(void);
|
|
||||||
|
|
||||||
static CCProgressTimer* progressWithFile(const char *pszFileName);
|
|
||||||
static CCProgressTimer* progressWithTexture(CCTexture2D *pTexture);
|
|
||||||
|
|
||||||
|
|
||||||
|
static CCProgressTimer* progressWithFile(const char *pszFileName);
|
||||||
|
static CCProgressTimer* progressWithTexture(CCTexture2D *pTexture);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
//! @brief CC RGBA protocol
|
|
||||||
class CCRGBAProtocol
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/** sets Color
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
void setColor(ccColor3B color);
|
|
||||||
|
|
||||||
/** returns the color
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
ccColor3B getColor(void);
|
|
||||||
|
|
||||||
// returns the opacity
|
|
||||||
GLubyte getOpacity(void);
|
|
||||||
|
|
||||||
/** sets the opacity.
|
|
||||||
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
|
|
||||||
Values goes from 0 to 255, where 255 means fully opaque.
|
|
||||||
*/
|
|
||||||
void setOpacity(GLubyte opacity);
|
|
||||||
|
|
||||||
// optional
|
|
||||||
|
|
||||||
/** sets the premultipliedAlphaOpacity property.
|
|
||||||
If set to NO then opacity will be applied as: glColor(R,G,B,opacity);
|
|
||||||
If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity );
|
|
||||||
Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
void setIsOpacityModifyRGB(bool bValue);
|
|
||||||
|
|
||||||
/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
bool getIsOpacityModifyRGB(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief You can specify the blending fuction.
|
|
||||||
@since v0.99.0
|
|
||||||
*/
|
|
||||||
class CCBlendProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
// set the source blending function for the texture
|
|
||||||
void setBlendFunc(ccBlendFunc blendFunc);
|
|
||||||
|
|
||||||
// returns the blending function used for the texture
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCNode objects that uses a Texture2D to render the images.
|
|
||||||
The texture can have a blending function.
|
|
||||||
If the texture has alpha premultiplied the default blending function is:
|
|
||||||
src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
|
|
||||||
else
|
|
||||||
src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
|
|
||||||
But you can change the blending funtion at any time.
|
|
||||||
@since v0.8.0
|
|
||||||
*/
|
|
||||||
class CCTextureProtocol : public CCBlendProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
// returns the used texture
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
|
|
||||||
// sets a new texture. it will be retained
|
|
||||||
void setTexture(CCTexture2D *texture);
|
|
||||||
};
|
|
||||||
|
|
||||||
//! @brief Common interface for Labels
|
|
||||||
class CCLabelProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
// sets a new label using an string
|
|
||||||
void setString(const char *label);
|
|
||||||
|
|
||||||
/** returns the string that is rendered */
|
|
||||||
const char* getString(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** OpenGL projection protocol */
|
|
||||||
class CCProjectionProtocol
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Called by CCDirector when the porjection is updated, and "custom" projection is used
|
|
||||||
@since v0.99.5
|
|
||||||
*/
|
|
||||||
void updateProjection(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,55 +1,24 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef enum eImageFormat
|
typedef enum eImageFormat
|
||||||
{
|
{
|
||||||
kCCImageFormatJPG = 0,
|
kCCImageFormatJPG = 0,
|
||||||
kCCImageFormatPNG = 1,
|
kCCImageFormatPNG = 1,
|
||||||
kCCImageFormatRawData = 2
|
kCCImageFormatRawData = 2
|
||||||
} tImageFormat;
|
} tImageFormat;
|
||||||
|
|
||||||
class CCRenderTexture : public CCNode
|
class CCRenderTexture : public CCNode
|
||||||
{
|
{
|
||||||
/** The CCSprite being used.
|
CCSprite* getSprite();
|
||||||
The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
|
void setSprite(CCSprite* psprite);
|
||||||
The blending function can be changed in runtime by calling:
|
|
||||||
- [[renderTexture sprite] setBlendFunc:(ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
|
||||||
*/
|
|
||||||
CCSprite* getSprite();
|
|
||||||
void setSprite(CCSprite* psprite);
|
|
||||||
|
|
||||||
CCRenderTexture();
|
void begin();
|
||||||
~CCRenderTexture();
|
void endToLua();
|
||||||
/** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
|
||||||
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
|
|
||||||
|
|
||||||
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
|
|
||||||
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
|
|
||||||
|
|
||||||
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
|
||||||
bool initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
|
|
||||||
|
|
||||||
/** starts grabbing */
|
|
||||||
void begin();
|
|
||||||
|
|
||||||
/** starts rendering to the texture while clearing the texture first.
|
|
||||||
This is more efficient then calling -clear first and then -begin */
|
|
||||||
void beginWithClear(float r, float g, float b, float a);
|
void beginWithClear(float r, float g, float b, float a);
|
||||||
|
|
||||||
/** ends grabbing */
|
|
||||||
void endToLua();
|
|
||||||
|
|
||||||
/** clears the texture with a color */
|
|
||||||
void clear(float r, float g, float b, float a);
|
void clear(float r, float g, float b, float a);
|
||||||
|
bool saveBuffer(const char *name);
|
||||||
|
bool saveBuffer(const char *name, int format);
|
||||||
|
|
||||||
/** saves the texture into a file */
|
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
|
||||||
bool saveBuffer(const char *name);
|
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
|
||||||
/** saves the texture into a file. The format can be JPG or PNG */
|
|
||||||
bool saveBuffer(const char *name, int format);
|
|
||||||
|
|
||||||
/* get buffer as UIImage, can only save a render buffer which has a RGBA8888 pixel format */
|
|
||||||
CCData *getUIImageAsDataFromBuffer(int format);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cocos2d
|
|
||||||
|
|
|
@ -1,46 +1,20 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCRibbon: public CCNode
|
class CCRibbon: public CCNode
|
||||||
{
|
{
|
||||||
|
void setTexture(CCTexture2D* val);
|
||||||
|
CCTexture2D* getTexture();
|
||||||
|
|
||||||
CCRibbon();
|
void setTextureLength(float val);
|
||||||
~CCRibbon();
|
float getTextureLength();
|
||||||
void setTexture(CCTexture2D* val);
|
|
||||||
CCTexture2D* getTexture();
|
|
||||||
/** Texture lengths in pixels */
|
|
||||||
float getTextureLength();
|
|
||||||
void setTextureLength(float val);
|
|
||||||
|
|
||||||
void setBlendFunc(ccBlendFunc val);
|
void setBlendFunc(ccBlendFunc val);
|
||||||
ccBlendFunc getBlendFunc();
|
ccBlendFunc getBlendFunc();
|
||||||
|
|
||||||
void setColor(ccColor4B val);
|
void setColor(ccColor4B val);
|
||||||
ccColor4B getColor();
|
ccColor4B getColor();
|
||||||
|
|
||||||
|
void addPointAt(CCPoint location, float width);
|
||||||
|
float sideOfLine(CCPoint p, CCPoint l1, CCPoint l2);
|
||||||
|
|
||||||
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
|
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
|
||||||
|
|
||||||
bool initWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
|
|
||||||
|
|
||||||
void addPointAt(CCPoint location, float width);
|
|
||||||
|
|
||||||
void update(ccTime delta);
|
|
||||||
|
|
||||||
float sideOfLine(CCPoint p, CCPoint l1, CCPoint l2);
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief object to hold ribbon segment data */
|
|
||||||
class CCRibbonSegment: public CCObject
|
|
||||||
{
|
|
||||||
CCRibbonSegment();
|
|
||||||
~CCRibbonSegment();
|
|
||||||
char * description();
|
|
||||||
bool init();
|
|
||||||
void reset();
|
|
||||||
void draw(float curTime, float fadeTime, ccColor4B color);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
|
|
||||||
class CCScene : public CCNode
|
class CCScene : public CCNode
|
||||||
{
|
{
|
||||||
|
void registerScriptEventsHandler(LUA_FUNCTION funcID);
|
||||||
|
void unregisterScriptEventsHandler(void);
|
||||||
|
|
||||||
CCScene();
|
static CCScene *node(void);
|
||||||
virtual ~CCScene();
|
|
||||||
bool init();
|
|
||||||
static CCScene *node(void);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,75 +1,29 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCTimer : public CCObject
|
class CCTimer : public CCObject
|
||||||
{
|
{
|
||||||
|
ccTime getInterval(void);
|
||||||
CCTimer(void);
|
void setInterval(ccTime fInterval);
|
||||||
|
void update(ccTime dt);
|
||||||
|
|
||||||
ccTime getInterval(void);
|
|
||||||
|
|
||||||
void setInterval(ccTime fInterval);
|
|
||||||
|
|
||||||
//bool initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector);
|
|
||||||
|
|
||||||
//bool initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds);
|
|
||||||
|
|
||||||
void update(ccTime dt);
|
|
||||||
|
|
||||||
//static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector);
|
|
||||||
|
|
||||||
//static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds);
|
|
||||||
|
|
||||||
bool initWithScriptFuncName(const char *pszFuncName, ccTime fSeconds);
|
|
||||||
bool initWithScriptFuncName(const char *pszFuncName, ccTime fSeconds);
|
|
||||||
|
|
||||||
//SEL_SCHEDULE m_pfnSelector;
|
|
||||||
ccTime m_fInterval;
|
|
||||||
std::string m_scriptFunc;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CCScheduler : public CCObject
|
class CCScheduler : public CCObject
|
||||||
{
|
{
|
||||||
~CCScheduler(void);
|
ccTime getTimeScale(void);
|
||||||
|
void setTimeScale(ccTime fTimeScale);
|
||||||
ccTime getTimeScale(void);
|
|
||||||
|
|
||||||
void setTimeScale(ccTime fTimeScale);
|
|
||||||
|
|
||||||
|
|
||||||
void tick(ccTime dt);
|
int scheduleScriptFunc(LUA_FUNCTION funcID, ccTime fInterval, bool bPaused);
|
||||||
|
void unscheduleScriptFunc(int scheduleEntryID);
|
||||||
|
|
||||||
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, ccTime fInterval, bool bPaused);
|
void scheduleUpdateForTarget(SelectorProtocol *pTarget, int nPriority, bool bPaused);
|
||||||
void scheduleScriptFunc(const char *pszFuncName, ccTime fInterval, bool bPaused);
|
void unscheduleUpdateForTarget(const SelectorProtocol *pTarget);
|
||||||
void unscheduleScriptFunc(const char *pszFuncName);
|
|
||||||
void scheduleUpdateForTarget(CCObject *pTarget, int nPriority, bool bPaused);
|
|
||||||
|
|
||||||
void unscheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget);
|
void unscheduleAllSelectorsForTarget(SelectorProtocol *pTarget);
|
||||||
|
void unscheduleAllSelectors(void);
|
||||||
void unscheduleUpdateForTarget(const CCObject *pTarget);
|
|
||||||
|
|
||||||
void unscheduleAllSelectorsForTarget(CCObject *pTarget);
|
|
||||||
|
|
||||||
void unscheduleAllSelectors(void);
|
|
||||||
|
|
||||||
|
|
||||||
void pauseTarget(CCObject *pTarget);
|
|
||||||
|
|
||||||
void resumeTarget(CCObject *pTarget);
|
|
||||||
|
|
||||||
bool isTargetPaused(CCObject *pTarget);
|
|
||||||
|
|
||||||
static CCScheduler* sharedScheduler(void);
|
|
||||||
|
|
||||||
/** purges the shared scheduler. It releases the retained instance.
|
|
||||||
@since v0.99.0
|
|
||||||
*/
|
|
||||||
static void purgeSharedScheduler(void);
|
|
||||||
|
|
||||||
|
void pauseTarget(SelectorProtocol *pTarget);
|
||||||
|
void resumeTarget(SelectorProtocol *pTarget);
|
||||||
|
bool isTargetPaused(SelectorProtocol *pTarget);
|
||||||
|
|
||||||
|
static CCScheduler* sharedScheduler(void);
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef std::set<CCObject *>::iterator CCSetIterator;
|
|
||||||
|
|
||||||
class CCSet : public CCObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CCSet(void);
|
|
||||||
CCSet(const CCSet &rSetObject);
|
|
||||||
~CCSet(void);
|
|
||||||
|
|
||||||
CCSet* copy();
|
|
||||||
CCSet* mutableCopy();
|
|
||||||
int count();
|
|
||||||
void addObject(CCObject *pObject);
|
|
||||||
void removeObject(CCObject *pObject);
|
|
||||||
bool containsObject(CCObject *pObject);
|
|
||||||
CCSetIterator begin();
|
|
||||||
CCSetIterator end();
|
|
||||||
CCObject* anyObject();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef CCSet NSMutableSet;
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
#define CCSpriteIndexNotInitialized 0xffffffff
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
//! Translate with it's parent
|
//! Translate with it's parent
|
||||||
CC_HONOR_PARENT_TRANSFORM_TRANSLATE = 1 << 0,
|
CC_HONOR_PARENT_TRANSFORM_TRANSLATE = 1 << 0,
|
||||||
|
@ -18,133 +14,55 @@ typedef enum {
|
||||||
|
|
||||||
} ccHonorParentTransform;
|
} ccHonorParentTransform;
|
||||||
|
|
||||||
class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
class CCSprite : public CCNode
|
||||||
{
|
{
|
||||||
|
|
||||||
void draw(void);
|
|
||||||
|
|
||||||
bool isDirty(void);
|
|
||||||
/** make the Sprite to be updated in the Atlas. */
|
|
||||||
void setDirty(bool bDirty);
|
void setDirty(bool bDirty);
|
||||||
|
bool isDirty(void);
|
||||||
|
|
||||||
/** get the quad (tex coords, vertex coords and color) information */
|
|
||||||
ccV3F_C4B_T2F_Quad getQuad(void);
|
ccV3F_C4B_T2F_Quad getQuad(void);
|
||||||
|
|
||||||
/** returns whether or not the texture rectangle is rotated */
|
CCRect getTextureRect(void);
|
||||||
|
bool isUsesBatchNode(void);
|
||||||
bool isTextureRectRotated(void);
|
bool isTextureRectRotated(void);
|
||||||
|
|
||||||
/** Set the index used on the TextureAtlas. */
|
|
||||||
unsigned int getAtlasIndex(void);
|
|
||||||
|
|
||||||
void setAtlasIndex(unsigned int uAtlasIndex);
|
void setAtlasIndex(unsigned int uAtlasIndex);
|
||||||
|
unsigned int getAtlasIndex(void);
|
||||||
CCRect getTextureRect(void);
|
|
||||||
|
|
||||||
bool isUsesBatchNode(void);
|
|
||||||
|
|
||||||
void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode);
|
void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode);
|
||||||
|
|
||||||
CCTextureAtlas* getTextureAtlas(void);
|
|
||||||
void setTextureAtlas(CCTextureAtlas *pobTextureAtlas);
|
void setTextureAtlas(CCTextureAtlas *pobTextureAtlas);
|
||||||
|
CCTextureAtlas* getTextureAtlas(void);
|
||||||
CCSpriteBatchNode* getSpriteBatchNode(void);
|
|
||||||
void setSpriteBatchNode(CCSpriteBatchNode *pobSpriteBatchNode);
|
void setSpriteBatchNode(CCSpriteBatchNode *pobSpriteBatchNode);
|
||||||
|
CCSpriteBatchNode* getSpriteBatchNode(void);
|
||||||
ccHonorParentTransform getHonorParentTransform(void);
|
|
||||||
void setHonorParentTransform(ccHonorParentTransform eHonorParentTransform);
|
void setHonorParentTransform(ccHonorParentTransform eHonorParentTransform);
|
||||||
|
ccHonorParentTransform getHonorParentTransform(void);
|
||||||
|
void setBlendFunc(ccBlendFunc blendFunc);
|
||||||
|
ccBlendFunc getBlendFunc(void);
|
||||||
|
|
||||||
CCPoint getOffsetPositionInPixels(void);
|
CCPoint getOffsetPositionInPixels(void);
|
||||||
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
|
||||||
void setBlendFunc(ccBlendFunc blendFunc);
|
|
||||||
|
|
||||||
|
|
||||||
static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
|
|
||||||
|
|
||||||
|
|
||||||
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect);
|
|
||||||
|
|
||||||
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset);
|
|
||||||
|
|
||||||
|
|
||||||
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
|
||||||
|
|
||||||
static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
|
|
||||||
|
|
||||||
|
|
||||||
static CCSprite* spriteWithFile(const char *pszFileName);
|
|
||||||
|
|
||||||
static CCSprite* spriteWithFile(const char *pszFileName, CCRect rect);
|
|
||||||
|
|
||||||
static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect);
|
|
||||||
|
|
||||||
|
|
||||||
bool init(void);
|
|
||||||
~CCSprite(void);
|
|
||||||
CCSprite();
|
|
||||||
|
|
||||||
void removeChild(CCNode* pChild, bool bCleanup);
|
|
||||||
void removeAllChildrenWithCleanup(bool bCleanup);
|
|
||||||
void reorderChild(CCNode *pChild, int zOrder);
|
|
||||||
void addChild(CCNode *pChild);
|
|
||||||
void addChild(CCNode *pChild, int zOrder);
|
|
||||||
void addChild(CCNode *pChild, int zOrder, int tag);
|
|
||||||
|
|
||||||
void setDirtyRecursively(bool bValue);
|
void setDirtyRecursively(bool bValue);
|
||||||
void setPosition(CCPoint pos);
|
|
||||||
void setPositionInPixels(CCPoint pos);
|
|
||||||
void setRotation(float fRotation);
|
|
||||||
void setSkewX(float sx);
|
|
||||||
void setSkewY(float sy);
|
|
||||||
void setScaleX(float fScaleX);
|
|
||||||
void setScaleY(float fScaleY);
|
|
||||||
void setScale(float fScale);
|
|
||||||
void setVertexZ(float fVertexZ);
|
|
||||||
void setAnchorPoint(CCPoint anchor);
|
|
||||||
void setIsRelativeAnchorPoint(bool bRelative);
|
void setIsRelativeAnchorPoint(bool bRelative);
|
||||||
void setIsVisible(bool bVisible);
|
|
||||||
void setFlipX(bool bFlipX);
|
void setFlipX(bool bFlipX);
|
||||||
void setFlipY(bool bFlipY);
|
void setFlipY(bool bFlipY);
|
||||||
|
|
||||||
bool isFlipX(void);
|
bool isFlipX(void);
|
||||||
|
|
||||||
bool isFlipY(void);
|
bool isFlipY(void);
|
||||||
|
|
||||||
void updateColor(void);
|
void updateColor(void);
|
||||||
|
|
||||||
GLubyte getOpacity(void);
|
|
||||||
void setOpacity(GLubyte opacity);
|
void setOpacity(GLubyte opacity);
|
||||||
/** RGB colors: conforms to CCRGBAProtocol protocol */
|
GLubyte getOpacity(void);
|
||||||
ccColor3B getColor(void);
|
|
||||||
|
tolua_property__CCOpacity GLubyte opacity;
|
||||||
|
|
||||||
void setColor(ccColor3B color3);
|
void setColor(ccColor3B color3);
|
||||||
|
ccColor3B getColor(void);
|
||||||
void setIsOpacityModifyRGB(bool bValue);
|
void setIsOpacityModifyRGB(bool bValue);
|
||||||
bool getIsOpacityModifyRGB(void);
|
bool getIsOpacityModifyRGB(void);
|
||||||
|
|
||||||
void setTexture(CCTexture2D *texture);
|
void setTexture(CCTexture2D *texture);
|
||||||
CCTexture2D* getTexture(void);
|
CCTexture2D* getTexture(void);
|
||||||
|
|
||||||
bool initWithTexture(CCTexture2D *pTexture);
|
|
||||||
|
|
||||||
bool initWithTexture(CCTexture2D *pTexture, CCRect rect);
|
|
||||||
|
|
||||||
bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
|
||||||
|
|
||||||
bool initWithSpriteFrameName(const char *pszSpriteFrameName);
|
|
||||||
|
|
||||||
bool initWithFile(const char *pszFilename);
|
|
||||||
|
|
||||||
bool initWithFile(const char *pszFilename, CCRect rect);
|
|
||||||
|
|
||||||
bool initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect);
|
|
||||||
|
|
||||||
bool initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, CCRect rect);
|
|
||||||
|
|
||||||
void updateTransform(void);
|
void updateTransform(void);
|
||||||
|
|
||||||
void useSelfRender(void);
|
void useSelfRender(void);
|
||||||
|
void setTextureRect(CCRect rect);
|
||||||
void setTextureRect(CCRect rect);
|
|
||||||
|
|
||||||
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
|
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
|
||||||
void useBatchNode(CCSpriteBatchNode *batchNode);
|
void useBatchNode(CCSpriteBatchNode *batchNode);
|
||||||
void setDisplayFrame(CCSpriteFrame *pNewFrame);
|
void setDisplayFrame(CCSpriteFrame *pNewFrame);
|
||||||
|
@ -152,6 +70,12 @@ class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
||||||
CCSpriteFrame* displayedFrame(void);
|
CCSpriteFrame* displayedFrame(void);
|
||||||
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
|
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
|
||||||
|
|
||||||
|
static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
|
||||||
|
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect);
|
||||||
|
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset);
|
||||||
|
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
||||||
|
static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
|
||||||
|
static CCSprite* spriteWithFile(const char *pszFileName);
|
||||||
|
static CCSprite* spriteWithFile(const char *pszFileName, CCRect rect);
|
||||||
|
static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect);
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,55 +1,27 @@
|
||||||
namespace cocos2d
|
|
||||||
|
class CCSpriteBatchNode : public CCNode
|
||||||
{
|
{
|
||||||
|
CCTextureAtlas* getTextureAtlas(void);
|
||||||
|
void setTextureAtlas(CCTextureAtlas* textureAtlas);
|
||||||
|
CCArray* getDescendants(void);
|
||||||
|
|
||||||
class CCSpriteBatchNode : public CCNode, public CCTextureProtocol
|
void increaseAtlasCapacity();
|
||||||
{
|
void removeChildAtIndex(unsigned int index, bool doCleanup);
|
||||||
|
void insertChild(CCSprite *child, unsigned int index);
|
||||||
~CCSpriteBatchNode();
|
void removeSpriteFromAtlas(CCSprite *sprite);
|
||||||
|
|
||||||
|
unsigned int rebuildIndexInOrder(CCSprite *parent, unsigned int index);
|
||||||
CCTextureAtlas* getTextureAtlas(void);
|
unsigned int highestAtlasIndexInChild(CCSprite *sprite);
|
||||||
void setTextureAtlas(CCTextureAtlas* textureAtlas);
|
unsigned int lowestAtlasIndexInChild(CCSprite *sprite);
|
||||||
CCArray* getDescendants(void);
|
unsigned int atlasIndexForChild(CCSprite *sprite, int z);
|
||||||
|
|
||||||
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D *tex);
|
void setTexture(CCTexture2D *texture);
|
||||||
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity);
|
CCTexture2D* getTexture(void);
|
||||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage);
|
void setBlendFunc(ccBlendFunc blendFunc);
|
||||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
|
ccBlendFunc getBlendFunc(void);
|
||||||
bool initWithTexture(CCTexture2D *tex, unsigned int capacity);
|
|
||||||
|
|
||||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
|
||||||
|
|
||||||
void increaseAtlasCapacity();
|
|
||||||
|
|
||||||
void removeChildAtIndex(unsigned int index, bool doCleanup);
|
|
||||||
|
|
||||||
void insertChild(CCSprite *child, unsigned int index);
|
|
||||||
void removeSpriteFromAtlas(CCSprite *sprite);
|
|
||||||
|
|
||||||
unsigned int rebuildIndexInOrder(CCSprite *parent, unsigned int index);
|
|
||||||
unsigned int highestAtlasIndexInChild(CCSprite *sprite);
|
|
||||||
unsigned int lowestAtlasIndexInChild(CCSprite *sprite);
|
|
||||||
unsigned int atlasIndexForChild(CCSprite *sprite, int z);
|
|
||||||
|
|
||||||
// CCTextureProtocol
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
void setTexture(CCTexture2D *texture);
|
|
||||||
void setBlendFunc(ccBlendFunc blendFunc);
|
|
||||||
ccBlendFunc getBlendFunc(void);
|
|
||||||
|
|
||||||
void visit(void);
|
|
||||||
void addChild(CCNode * child);
|
|
||||||
void addChild(CCNode * child, int zOrder);
|
|
||||||
void addChild(CCNode * child, int zOrder, int tag);
|
|
||||||
void reorderChild(CCNode * child, int zOrder);
|
|
||||||
|
|
||||||
void removeChild(CCNode* child, bool cleanup);
|
|
||||||
void removeAllChildrenWithCleanup(bool cleanup);
|
|
||||||
void draw(void);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D *tex);
|
||||||
|
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity);
|
||||||
|
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage);
|
||||||
|
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
|
||||||
|
};
|
||||||
|
|
|
@ -1,49 +1,24 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCSpriteFrame : public CCObject
|
class CCSpriteFrame : public CCObject
|
||||||
{
|
{
|
||||||
|
CCRect getRectInPixels(void);
|
||||||
|
void setRectInPixels(CCRect rectInPixels);
|
||||||
|
|
||||||
CCRect getRectInPixels(void);
|
bool isRotated(void);
|
||||||
void setRectInPixels(CCRect rectInPixels);
|
void setRotated(bool bRotated);
|
||||||
|
|
||||||
bool isRotated(void);
|
CCRect getRect(void);
|
||||||
void setRotated(bool bRotated);
|
void setRect(CCRect rect);
|
||||||
|
|
||||||
CCRect getRect(void);
|
CCPoint getOffsetInPixels(void);
|
||||||
void setRect(CCRect rect);
|
void setOffsetInPixels(CCPoint offsetInPixels);
|
||||||
|
|
||||||
CCPoint getOffsetInPixels(void);
|
CCSize getOriginalSizeInPixels(void);
|
||||||
void setOffsetInPixels(CCPoint offsetInPixels);
|
void setOriginalSizeInPixels(CCSize sizeInPixels);
|
||||||
|
|
||||||
CCSize getOriginalSizeInPixels(void);
|
CCTexture2D* getTexture(void);
|
||||||
void setOriginalSizeInPixels(CCSize sizeInPixels);
|
void setTexture(CCTexture2D* pobTexture);
|
||||||
|
|
||||||
CCTexture2D* getTexture(void);
|
|
||||||
void setTexture(CCTexture2D* pobTexture);
|
|
||||||
|
|
||||||
~CCSpriteFrame(void);
|
|
||||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
||||||
|
|
||||||
/** Create a CCSpriteFrame with a texture, rect in points.
|
|
||||||
It is assumed that the frame was not trimmed.
|
|
||||||
*/
|
|
||||||
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
|
||||||
|
|
||||||
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
|
||||||
The originalSize is the size in points of the frame before being trimmed.
|
|
||||||
*/
|
|
||||||
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize);
|
|
||||||
|
|
||||||
|
|
||||||
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
|
||||||
|
|
||||||
/** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
|
||||||
The originalSize is the size in points of the frame before being trimmed.
|
|
||||||
*/
|
|
||||||
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize);
|
|
||||||
|
|
||||||
|
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
||||||
|
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,49 +1,21 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCSpriteFrameCache : public CCObject
|
class CCSpriteFrameCache : public CCObject
|
||||||
{
|
{
|
||||||
|
void addSpriteFramesWithDictionary(CCDictionary<std::string, CCObject*> *pobDictionary, CCTexture2D *pobTexture);
|
||||||
|
void addSpriteFramesWithFile(const char *pszPlist);
|
||||||
|
void addSpriteFramesWithFile(const char* plist, const char* textureFileName);
|
||||||
|
void addSpriteFramesWithFile(const char *pszPlist, CCTexture2D *pobTexture);
|
||||||
|
void addSpriteFrame(CCSpriteFrame *pobFrame, const char *pszFrameName);
|
||||||
|
|
||||||
bool init(void);
|
void removeSpriteFrames(void);
|
||||||
~CCSpriteFrameCache(void);
|
void removeUnusedSpriteFrames(void);
|
||||||
|
void removeSpriteFrameByName(const char *pszName);
|
||||||
void addSpriteFramesWithDictionary(CCDictionary<std::string, CCObject*> *pobDictionary, CCTexture2D *pobTexture);
|
void removeSpriteFramesFromFile(const char* plist);
|
||||||
|
void removeSpriteFramesFromDictionary(CCDictionary<std::string, CCSpriteFrame*> *dictionary);
|
||||||
void addSpriteFramesWithFile(const char *pszPlist);
|
void removeSpriteFramesFromTexture(CCTexture2D* texture);
|
||||||
|
|
||||||
|
|
||||||
void addSpriteFramesWithFile(const char* plist, const char* textureFileName);
|
|
||||||
|
|
||||||
/** Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames. */
|
|
||||||
void addSpriteFramesWithFile(const char *pszPlist, CCTexture2D *pobTexture);
|
|
||||||
|
|
||||||
void addSpriteFrame(CCSpriteFrame *pobFrame, const char *pszFrameName);
|
|
||||||
|
|
||||||
|
|
||||||
void removeSpriteFrames(void);
|
|
||||||
|
|
||||||
void removeUnusedSpriteFrames(void);
|
|
||||||
|
|
||||||
/** Deletes an sprite frame from the sprite frame cache. */
|
|
||||||
void removeSpriteFrameByName(const char *pszName);
|
|
||||||
|
|
||||||
void removeSpriteFramesFromFile(const char* plist);
|
|
||||||
|
|
||||||
void removeSpriteFramesFromDictionary(CCDictionary<std::string, CCSpriteFrame*> *dictionary);
|
|
||||||
|
|
||||||
|
|
||||||
void removeSpriteFramesFromTexture(CCTexture2D* texture);
|
|
||||||
|
|
||||||
CCSpriteFrame* spriteFrameByName(const char *pszName);
|
|
||||||
|
|
||||||
|
|
||||||
/** Returns the shared instance of the Sprite Frame cache */
|
|
||||||
static CCSpriteFrameCache* sharedSpriteFrameCache(void);
|
|
||||||
|
|
||||||
/** Purges the cache. It releases all the Sprite Frames and the retained instance. */
|
|
||||||
static void purgeSharedSpriteFrameCache(void);
|
|
||||||
|
|
||||||
|
CCSpriteFrame* spriteFrameByName(const char *pszName);
|
||||||
|
|
||||||
|
static CCSpriteFrameCache* sharedSpriteFrameCache(void);
|
||||||
|
static void purgeSharedSpriteFrameCache(void);
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
class CCString : public CCObject
|
||||||
|
{
|
||||||
|
CCString();
|
||||||
|
CCString(const char * str);
|
||||||
|
~CCString();
|
||||||
|
|
||||||
class CCString : public CCObject
|
int toInt();
|
||||||
{
|
unsigned int toUInt();
|
||||||
|
float toFloat();
|
||||||
CCString();
|
bool isEmpty();
|
||||||
CCString(const char * str);
|
};
|
||||||
~CCString();
|
|
||||||
int toInt();
|
|
||||||
unsigned int toUInt();
|
|
||||||
float toFloat();
|
|
||||||
|
|
||||||
bool isEmpty();
|
|
||||||
};
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
|
@ -1,85 +1,36 @@
|
||||||
namespace cocos2d {
|
|
||||||
class CCTMXLayer : public CCSpriteBatchNode
|
|
||||||
{
|
|
||||||
/** size of the layer in tiles */
|
|
||||||
CCSize getLayerSize();
|
|
||||||
void setLayerSize(CCSize val);
|
|
||||||
/** size of the map's tile (could be differnt from the tile's size) */
|
|
||||||
CCSize getMapTileSize();
|
|
||||||
void setMapTileSize(CCSize val);
|
|
||||||
/** pointer to the map of tiles */
|
|
||||||
unsigned int* getTiles();
|
|
||||||
void setTiles(unsigned int* pval);
|
|
||||||
|
|
||||||
/** Tilset information for the layer */
|
|
||||||
CCTMXTilesetInfo* getTileSet();
|
|
||||||
void setTileSet(CCTMXTilesetInfo* pval);
|
|
||||||
|
|
||||||
/** Layer orientation, which is the same as the map orientation */
|
|
||||||
void setLayerOrientation(unsigned int val);
|
|
||||||
unsigned int getLayerOrientation();
|
|
||||||
/** properties from the layer. They can be added using Tiled */
|
|
||||||
CCStringToStringDictionary* getProperties();
|
|
||||||
void setProperties(CCStringToStringDictionary* pval);
|
|
||||||
|
|
||||||
CCTMXLayer();
|
|
||||||
~CCTMXLayer();
|
|
||||||
/** creates a CCTMXLayer with an tileset info, a layer info and a map info */
|
|
||||||
static CCTMXLayer * layerWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerInfo *layerInfo, CCTMXMapInfo *mapInfo);
|
|
||||||
/** initializes a CCTMXLayer with a tileset info, a layer info and a map info */
|
|
||||||
bool initWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerInfo *layerInfo, CCTMXMapInfo *mapInfo);
|
|
||||||
|
|
||||||
/** dealloc the map that contains the tile position from memory.
|
class CCTMXLayer : public CCSpriteBatchNode
|
||||||
Unless you want to know at runtime the tiles positions, you can safely call this method.
|
{
|
||||||
If you are going to call layer->tileGIDAt() then, don't release the map
|
void setLayerSize(CCSize val);
|
||||||
*/
|
CCSize getLayerSize();
|
||||||
void releaseMap();
|
|
||||||
|
|
||||||
/** returns the tile (CCSprite) at a given a tile coordinate.
|
void setMapTileSize(CCSize val);
|
||||||
The returned CCSprite will be already added to the CCTMXLayer. Don't add it again.
|
CCSize getMapTileSize();
|
||||||
The CCSprite can be treated like any other CCSprite: rotated, scaled, translated, opacity, color, etc.
|
|
||||||
You can remove either by calling:
|
|
||||||
- layer->removeChild(sprite, cleanup);
|
|
||||||
- or layer->removeTileAt(ccp(x,y));
|
|
||||||
*/
|
|
||||||
CCSprite* tileAt(CCPoint tileCoordinate);
|
|
||||||
|
|
||||||
/** returns the tile gid at a given tile coordinate.
|
void setTiles(unsigned int* pval);
|
||||||
if it returns 0, it means that the tile is empty.
|
unsigned int* getTiles();
|
||||||
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
|
|
||||||
*/
|
|
||||||
unsigned int tileGIDAt(CCPoint tileCoordinate);
|
|
||||||
|
|
||||||
/** sets the tile gid (gid = tile global id) at a given tile coordinate.
|
void setTileSet(CCTMXTilesetInfo* pval);
|
||||||
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
|
CCTMXTilesetInfo* getTileSet();
|
||||||
If a tile is already placed at that position, then it will be removed.
|
|
||||||
*/
|
|
||||||
void setTileGID(unsigned int gid, CCPoint tileCoordinate);
|
|
||||||
|
|
||||||
/** removes a tile at given tile coordinate */
|
void setLayerOrientation(unsigned int val);
|
||||||
void removeTileAt(CCPoint tileCoordinate);
|
unsigned int getLayerOrientation();
|
||||||
|
|
||||||
/** returns the position in pixels of a given tile coordinate */
|
void setProperties(CCStringToStringDictionary* pval);
|
||||||
CCPoint positionAt(CCPoint tileCoordinate);
|
CCStringToStringDictionary* getProperties();
|
||||||
|
|
||||||
/** return the value for the specific property name */
|
void releaseMap();
|
||||||
CCString *propertyNamed(const char *propertyName);
|
|
||||||
|
|
||||||
/** Creates the tiles */
|
CCSprite* tileAt(CCPoint tileCoordinate);
|
||||||
void setupTiles();
|
unsigned int tileGIDAt(CCPoint tileCoordinate);
|
||||||
|
void setTileGID(unsigned int gid, CCPoint tileCoordinate);
|
||||||
/** CCTMXLayer doesn't support adding a CCSprite manually.
|
void removeTileAt(CCPoint tileCoordinate);
|
||||||
@warning addchild(z, tag); is not supported on CCTMXLayer. Instead of setTileGID.
|
CCPoint positionAt(CCPoint tileCoordinate);
|
||||||
*/
|
CCString *propertyNamed(const char *propertyName);
|
||||||
virtual void addChild(CCNode * child, int zOrder, int tag);
|
void setupTiles();
|
||||||
// super method
|
|
||||||
void removeChild(CCNode* child, bool cleanup);
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
const char* getLayerName();
|
|
||||||
void setLayerName(const char *layerName);
|
|
||||||
};
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
void setLayerName(const char *layerName);
|
||||||
|
const char* getLayerName();
|
||||||
|
|
||||||
|
static CCTMXLayer * layerWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerInfo *layerInfo, CCTMXMapInfo *mapInfo);
|
||||||
|
};
|
||||||
|
|
|
@ -1,35 +1,19 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
/** @brief CCTMXObjectGroup represents the TMX object group.
|
class CCTMXObjectGroup : public CCObject
|
||||||
@since v0.99.0
|
{
|
||||||
*/
|
void setPositionOffset(CCPoint pt);
|
||||||
class CCTMXObjectGroup : public CCObject
|
CCPoint getPositionOffset();
|
||||||
{
|
|
||||||
/** offset position of child objects */
|
|
||||||
CCPoint getPositionOffset();
|
|
||||||
void setPositionOffset(CCPoint pt);
|
|
||||||
/** list of properties stored in a dictionary */
|
|
||||||
CCStringToStringDictionary* getProperties();
|
|
||||||
void setProperties(CCStringToStringDictionary* pval);
|
|
||||||
/** array of the objects */
|
|
||||||
|
|
||||||
CCMutableArray<CCStringToStringDictionary*>* getObjects();
|
void setProperties(CCStringToStringDictionary* pval);
|
||||||
void setObjects(CCMutableArray<CCStringToStringDictionary*>* val);
|
CCStringToStringDictionary* getProperties();
|
||||||
|
|
||||||
CCTMXObjectGroup();
|
void setObjects(CCMutableArray<CCStringToStringDictionary*>* val);
|
||||||
~CCTMXObjectGroup();
|
CCMutableArray<CCStringToStringDictionary*>* getObjects();
|
||||||
|
|
||||||
const char* getGroupName();
|
void setGroupName(const char *groupName);
|
||||||
void setGroupName(const char *groupName);
|
const char* getGroupName();
|
||||||
|
|
||||||
/** return the value for the specific property name */
|
CCString *propertyNamed(const char* propertyName);
|
||||||
CCString *propertyNamed(const char* propertyName);
|
|
||||||
|
|
||||||
/** return the dictionary for the specific object name.
|
CCStringToStringDictionary* objectNamed(const char *objectName);
|
||||||
It will return the 1st object found on the array for the given name.
|
};
|
||||||
*/
|
|
||||||
CCStringToStringDictionary *objectNamed(const char *objectName);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
|
@ -1,60 +1,35 @@
|
||||||
namespace cocos2d {
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/** Orthogonal orientation */
|
|
||||||
CCTMXOrientationOrtho,
|
|
||||||
|
|
||||||
/** Hexagonal orientation */
|
enum
|
||||||
CCTMXOrientationHex,
|
{
|
||||||
|
/** Orthogonal orientation */
|
||||||
|
CCTMXOrientationOrtho,
|
||||||
|
/** Hexagonal orientation */
|
||||||
|
CCTMXOrientationHex,
|
||||||
|
/** Isometric orientation */
|
||||||
|
CCTMXOrientationIso,
|
||||||
|
};
|
||||||
|
|
||||||
/** Isometric orientation */
|
class CCTMXTiledMap : public CCNode
|
||||||
CCTMXOrientationIso,
|
{
|
||||||
};
|
void setMapSize(CCSize sz);
|
||||||
|
CCSize getMapSize();
|
||||||
|
|
||||||
|
void setTileSize(CCSize sz);
|
||||||
class CCTMXTiledMap : public CCNode
|
CCSize getTileSize();
|
||||||
{
|
|
||||||
/** the map's size property measured in tiles */
|
|
||||||
CCSize getMapSize();
|
|
||||||
void setMapSize(CCSize sz);
|
|
||||||
/** the tiles's size property measured in pixels */
|
|
||||||
CCSize getTileSize();
|
|
||||||
void setTileSize(CCSize sz);
|
|
||||||
/** map orientation */
|
|
||||||
int getMapOrientation();
|
|
||||||
void setMapOrientation(int val);
|
|
||||||
/** object groups */
|
|
||||||
|
|
||||||
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
void setMapOrientation(int val);
|
||||||
void setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* pval);
|
int getMapOrientation();
|
||||||
/** properties */
|
|
||||||
CCStringToStringDictionary* getProperties();
|
|
||||||
void setProperties(CCStringToStringDictionary* pval);
|
|
||||||
|
|
||||||
CCTMXTiledMap();
|
void setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* pval);
|
||||||
~CCTMXTiledMap();
|
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
||||||
|
|
||||||
/** creates a TMX Tiled Map with a TMX file.*/
|
|
||||||
static CCTMXTiledMap * tiledMapWithTMXFile(const char *tmxFile);
|
|
||||||
|
|
||||||
/** initializes a TMX Tiled Map with a TMX file */
|
|
||||||
bool initWithTMXFile(const char *tmxFile);
|
|
||||||
|
|
||||||
/** return the TMXLayer for the specific layer */
|
|
||||||
CCTMXLayer* layerNamed(const char *layerName);
|
|
||||||
|
|
||||||
/** return the TMXObjectGroup for the secific group */
|
|
||||||
CCTMXObjectGroup* objectGroupNamed(const char *groupName);
|
|
||||||
|
|
||||||
/** return the value for the specific property name */
|
|
||||||
CCString *propertyNamed(const char *propertyName);
|
|
||||||
|
|
||||||
/** return properties dictionary for tile GID */
|
|
||||||
CCDictionary<std::string, CCString*> *propertiesForGID(int GID);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
void setProperties(CCStringToStringDictionary* pval);
|
||||||
|
CCStringToStringDictionary* getProperties();
|
||||||
|
|
||||||
|
CCTMXLayer* layerNamed(const char *layerName);
|
||||||
|
CCTMXObjectGroup* objectGroupNamed(const char *groupName);
|
||||||
|
CCString *propertyNamed(const char *propertyName);
|
||||||
|
CCDictionary<std::string, CCString*> *propertiesForGID(int GID);
|
||||||
|
|
||||||
|
static CCTMXTiledMap * tiledMapWithTMXFile(const char *tmxFile);
|
||||||
|
};
|
||||||
|
|
|
@ -1,118 +1,66 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TMXLayerAttribNone = 1 << 0,
|
TMXLayerAttribNone = 1 << 0,
|
||||||
TMXLayerAttribBase64 = 1 << 1,
|
TMXLayerAttribBase64 = 1 << 1,
|
||||||
TMXLayerAttribGzip = 1 << 2,
|
TMXLayerAttribGzip = 1 << 2,
|
||||||
TMXLayerAttribZlib = 1 << 3,
|
TMXLayerAttribZlib = 1 << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TMXPropertyNone,
|
TMXPropertyNone,
|
||||||
TMXPropertyMap,
|
TMXPropertyMap,
|
||||||
TMXPropertyLayer,
|
TMXPropertyLayer,
|
||||||
TMXPropertyObjectGroup,
|
TMXPropertyObjectGroup,
|
||||||
TMXPropertyObject,
|
TMXPropertyObject,
|
||||||
TMXPropertyTile
|
TMXPropertyTile
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCTMXLayerInfo : public CCObject
|
class CCTMXLayerInfo : public CCObject
|
||||||
{
|
{
|
||||||
CCStringToStringDictionary* getProperties();
|
CCStringToStringDictionary* getProperties();
|
||||||
void setProperties(CCStringToStringDictionary* pval);
|
void setProperties(CCStringToStringDictionary* pval);
|
||||||
|
};
|
||||||
CCTMXLayerInfo();
|
|
||||||
~CCTMXLayerInfo();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
class CCTMXTilesetInfo : public CCObject
|
||||||
class CCTMXTilesetInfo : public CCObject
|
{
|
||||||
{
|
CCRect rectForGID(unsigned int gid);
|
||||||
|
};
|
||||||
CCTMXTilesetInfo();
|
|
||||||
~CCTMXTilesetInfo();
|
|
||||||
CCRect rectForGID(unsigned int gid);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCTMXMapInfo contains the information about the map like:
|
|
||||||
- Map orientation (hexagonal, isometric or orthogonal)
|
|
||||||
- Tile size
|
|
||||||
- Map size
|
|
||||||
|
|
||||||
And it also contains:
|
|
||||||
- Layers (an array of TMXLayerInfo objects)
|
|
||||||
- Tilesets (an array of TMXTilesetInfo objects)
|
|
||||||
- ObjectGroups (an array of TMXObjectGroupInfo objects)
|
|
||||||
|
|
||||||
This information is obtained from the TMX file.
|
|
||||||
|
|
||||||
*/
|
|
||||||
class CCTMXMapInfo : public CCObject, public CCSAXDelegator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// map orientation
|
|
||||||
int getOrientation();
|
|
||||||
void setOrientation(int val);
|
|
||||||
/// map width & height
|
|
||||||
CCSize getMapSize();
|
|
||||||
void setMapSize(CCSize sz);
|
|
||||||
/// tiles width & height
|
|
||||||
|
|
||||||
CCSize getTileSize();
|
|
||||||
void setTileSize(CCSize sz);
|
|
||||||
/// Layers
|
|
||||||
CCMutableArray<CCTMXLayerInfo*>* getLayers();
|
|
||||||
void setLayers(CCMutableArray<CCTMXLayerInfo*>* pval);
|
|
||||||
/// tilesets
|
|
||||||
CCMutableArray<CCTMXTilesetInfo*>* getTilesets();
|
|
||||||
void setTilesets(CCMutableArray<CCTMXTilesetInfo*>* pval);
|
|
||||||
|
|
||||||
/// ObjectGroups
|
|
||||||
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
|
||||||
void setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* val);
|
|
||||||
/// parent element
|
|
||||||
int getParentElement();
|
|
||||||
void setParentElement(int val);
|
|
||||||
/// parent GID
|
|
||||||
unsigned int getParentGID();
|
|
||||||
void setParentGID(unsigned int val);
|
|
||||||
|
|
||||||
/// layer attribs
|
|
||||||
int getLayerAttribs();
|
|
||||||
void setLayerAttribs(int val);
|
|
||||||
/// is stroing characters?
|
|
||||||
bool getStoringCharacters();
|
|
||||||
void setStoringCharacters(bool val);
|
|
||||||
|
|
||||||
/// properties
|
|
||||||
CCStringToStringDictionary* getProperties();
|
|
||||||
void setProperties(CCStringToStringDictionary* pval);
|
|
||||||
|
|
||||||
CCTMXMapInfo();
|
|
||||||
~CCTMXMapInfo();
|
|
||||||
/** creates a TMX Format with a tmx file */
|
|
||||||
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile);
|
|
||||||
/** initializes a TMX format witha tmx file */
|
|
||||||
bool initWithTMXFile(const char *tmxFile);
|
|
||||||
/** initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file */
|
|
||||||
bool parseXMLFile(const char *xmlFilename);
|
|
||||||
|
|
||||||
CCDictionary<int, CCStringToStringDictionary*> * getTileProperties();
|
|
||||||
void setTileProperties(CCDictionary<int, CCStringToStringDictionary*> * tileProperties);
|
|
||||||
|
|
||||||
// implement pure virtual methods of CCSAXDelegator
|
|
||||||
void startElement(void *ctx, const char *name, const char **atts);
|
|
||||||
void endElement(void *ctx, const char *name);
|
|
||||||
void textHandler(void *ctx, const char *ch, int len);
|
|
||||||
|
|
||||||
const char* getCurrentString();
|
|
||||||
void setCurrentString(const char *currentString);
|
|
||||||
const char* getTMXFileName();
|
|
||||||
void setTMXFileName(const char *fileName);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
class CCTMXMapInfo : public CCObject
|
||||||
|
{
|
||||||
|
void setOrientation(int val);
|
||||||
|
int getOrientation();
|
||||||
|
void setMapSize(CCSize sz);
|
||||||
|
CCSize getMapSize();
|
||||||
|
void setTileSize(CCSize sz);
|
||||||
|
CCSize getTileSize();
|
||||||
|
void setLayers(CCMutableArray<CCTMXLayerInfo*>* pval);
|
||||||
|
CCMutableArray<CCTMXLayerInfo*>* getLayers();
|
||||||
|
void setTilesets(CCMutableArray<CCTMXTilesetInfo*>* pval);
|
||||||
|
CCMutableArray<CCTMXTilesetInfo*>* getTilesets();
|
||||||
|
void setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* val);
|
||||||
|
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
||||||
|
void setParentElement(int val);
|
||||||
|
int getParentElement();
|
||||||
|
void setParentGID(unsigned int val);
|
||||||
|
unsigned int getParentGID();
|
||||||
|
void setLayerAttribs(int val);
|
||||||
|
int getLayerAttribs();
|
||||||
|
void setStoringCharacters(bool val);
|
||||||
|
bool getStoringCharacters();
|
||||||
|
void setProperties(CCStringToStringDictionary* pval);
|
||||||
|
CCStringToStringDictionary* getProperties();
|
||||||
|
void setTileProperties(CCDictionary<int, CCStringToStringDictionary*> * tileProperties);
|
||||||
|
CCDictionary<int, CCStringToStringDictionary*> * getTileProperties();
|
||||||
|
void setCurrentString(const char *currentString);
|
||||||
|
const char* getCurrentString();
|
||||||
|
void setTMXFileName(const char *fileName);
|
||||||
|
const char* getTMXFileName();
|
||||||
|
|
||||||
|
void startElement(void *ctx, const char *name, const char **atts);
|
||||||
|
void endElement(void *ctx, const char *name);
|
||||||
|
void textHandler(void *ctx, const char *ch, int len);
|
||||||
|
bool parseXMLFile(const char *xmlFilename);
|
||||||
|
|
||||||
|
static CCTMXMapInfo * formatWithTMXFile(const char *tmxFile);
|
||||||
|
};
|
||||||
|
|
|
@ -1,79 +1,18 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
|
class CCTextFieldTTF : public CCLabelTTF
|
||||||
class CCTextFieldDelegate
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
@brief If the sender doesn't want to attach with IME, return true;
|
|
||||||
*/
|
|
||||||
bool onTextFieldAttachWithIME(CCTextFieldTTF * sender);
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief If the sender doesn't want to detach with IME, return true;
|
|
||||||
*/
|
|
||||||
bool onTextFieldDetachWithIME(CCTextFieldTTF * sender);
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief If the sender doesn't want to insert the text, return true;
|
|
||||||
*/
|
|
||||||
bool onTextFieldInsertText(CCTextFieldTTF * sender, const char * text, int nLen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief If the sender doesn't want to delete the delText, return true;
|
|
||||||
*/
|
|
||||||
bool onTextFieldDeleteBackward(CCTextFieldTTF * sender, const char * delText, int nLen);
|
|
||||||
/**
|
|
||||||
@brief If doesn't want draw sender as default, return true.
|
|
||||||
*/
|
|
||||||
bool onDraw(CCTextFieldTTF * sender);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief A simple text input field with TTF font.
|
|
||||||
*/
|
|
||||||
class CCTextFieldTTF : public CCLabelTTF, public CCIMEDelegate
|
|
||||||
{
|
|
||||||
CCTextFieldTTF();
|
|
||||||
~CCTextFieldTTF();
|
|
||||||
|
|
||||||
//char * description();
|
|
||||||
|
|
||||||
/** creates a CCTextFieldTTF from a fontname, alignment, dimension and font size */
|
|
||||||
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
|
||||||
/** creates a CCLabelTTF from a fontname and font size */
|
|
||||||
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
|
|
||||||
/** initializes the CCTextFieldTTF with a font name, alignment, dimension and font size */
|
|
||||||
bool initWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
|
||||||
/** initializes the CCTextFieldTTF with a font name and font size */
|
|
||||||
bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Open keyboard and receive input text.
|
|
||||||
*/
|
|
||||||
bool attachWithIME();
|
bool attachWithIME();
|
||||||
|
|
||||||
/**
|
|
||||||
@brief End text input and close keyboard.
|
|
||||||
*/
|
|
||||||
bool detachWithIME();
|
bool detachWithIME();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// properties
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
CCTextFieldDelegate* getDelegate();
|
|
||||||
void setDelegate(CCTextFieldDelegate *pVal);
|
|
||||||
|
|
||||||
int getCharCount();
|
int getCharCount();
|
||||||
|
void setColorSpaceHolder(ccColor3B val);
|
||||||
ccColor3B getColorSpaceHolder();
|
ccColor3B getColorSpaceHolder();
|
||||||
void setColorSpaceHolder(ccColor3B val);
|
void setString(const char *text);
|
||||||
// input text property
|
const char* getString(void);
|
||||||
void setString(const char *text);
|
|
||||||
const char* getString(void);
|
|
||||||
|
|
||||||
void setPlaceHolder(const char * text);
|
void setPlaceHolder(const char * text);
|
||||||
const char * getPlaceHolder(void);
|
const char * getPlaceHolder(void);
|
||||||
|
|
||||||
|
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
||||||
|
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
|
||||||
};
|
};
|
||||||
}
|
|
|
@ -1,119 +1,72 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCImage;
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
kCCTexture2DPixelFormat_Automatic = 0,
|
kCCTexture2DPixelFormat_Automatic = 0,
|
||||||
//! 32-bit texture: RGBA8888
|
//! 32-bit texture: RGBA8888
|
||||||
kCCTexture2DPixelFormat_RGBA8888,
|
kCCTexture2DPixelFormat_RGBA8888,
|
||||||
//! 24-bit texture: RGBA888
|
//! 24-bit texture: RGBA888
|
||||||
kCCTexture2DPixelFormat_RGB888,
|
kCCTexture2DPixelFormat_RGB888,
|
||||||
//! 16-bit texture without Alpha channel
|
//! 16-bit texture without Alpha channel
|
||||||
kCCTexture2DPixelFormat_RGB565,
|
kCCTexture2DPixelFormat_RGB565,
|
||||||
//! 8-bit textures used as masks
|
//! 8-bit textures used as masks
|
||||||
kCCTexture2DPixelFormat_A8,
|
kCCTexture2DPixelFormat_A8,
|
||||||
//! 8-bit intensity texture
|
//! 8-bit intensity texture
|
||||||
kCCTexture2DPixelFormat_I8,
|
kCCTexture2DPixelFormat_I8,
|
||||||
//! 16-bit textures used as masks
|
//! 16-bit textures used as masks
|
||||||
kCCTexture2DPixelFormat_AI88,
|
kCCTexture2DPixelFormat_AI88,
|
||||||
//! 16-bit textures: RGBA4444
|
//! 16-bit textures: RGBA4444
|
||||||
kCCTexture2DPixelFormat_RGBA4444,
|
kCCTexture2DPixelFormat_RGBA4444,
|
||||||
//! 16-bit textures: RGB5A1
|
//! 16-bit textures: RGB5A1
|
||||||
kCCTexture2DPixelFormat_RGB5A1,
|
kCCTexture2DPixelFormat_RGB5A1,
|
||||||
//! 4-bit PVRTC-compressed texture: PVRTC4
|
//! 4-bit PVRTC-compressed texture: PVRTC4
|
||||||
kCCTexture2DPixelFormat_PVRTC4,
|
kCCTexture2DPixelFormat_PVRTC4,
|
||||||
//! 2-bit PVRTC-compressed texture: PVRTC2
|
//! 2-bit PVRTC-compressed texture: PVRTC2
|
||||||
kCCTexture2DPixelFormat_PVRTC2,
|
kCCTexture2DPixelFormat_PVRTC2,
|
||||||
|
|
||||||
//! Default texture format: RGBA8888
|
//! Default texture format: RGBA8888
|
||||||
kCCTexture2DPixelFormat_Default = kCCTexture2DPixelFormat_RGBA8888,
|
kCCTexture2DPixelFormat_Default = kCCTexture2DPixelFormat_RGBA8888,
|
||||||
|
|
||||||
// backward compatibility stuff
|
|
||||||
kTexture2DPixelFormat_Automatic = kCCTexture2DPixelFormat_Automatic,
|
|
||||||
kTexture2DPixelFormat_RGBA8888 = kCCTexture2DPixelFormat_RGBA8888,
|
|
||||||
kTexture2DPixelFormat_RGB888 = kCCTexture2DPixelFormat_RGB888,
|
|
||||||
kTexture2DPixelFormat_RGB565 = kCCTexture2DPixelFormat_RGB565,
|
|
||||||
kTexture2DPixelFormat_A8 = kCCTexture2DPixelFormat_A8,
|
|
||||||
kTexture2DPixelFormat_RGBA4444 = kCCTexture2DPixelFormat_RGBA4444,
|
|
||||||
kTexture2DPixelFormat_RGB5A1 = kCCTexture2DPixelFormat_RGB5A1,
|
|
||||||
kTexture2DPixelFormat_Default = kCCTexture2DPixelFormat_Default
|
|
||||||
|
|
||||||
|
// backward compatibility stuff
|
||||||
|
kTexture2DPixelFormat_Automatic = kCCTexture2DPixelFormat_Automatic,
|
||||||
|
kTexture2DPixelFormat_RGBA8888 = kCCTexture2DPixelFormat_RGBA8888,
|
||||||
|
kTexture2DPixelFormat_RGB888 = kCCTexture2DPixelFormat_RGB888,
|
||||||
|
kTexture2DPixelFormat_RGB565 = kCCTexture2DPixelFormat_RGB565,
|
||||||
|
kTexture2DPixelFormat_A8 = kCCTexture2DPixelFormat_A8,
|
||||||
|
kTexture2DPixelFormat_RGBA4444 = kCCTexture2DPixelFormat_RGBA4444,
|
||||||
|
kTexture2DPixelFormat_RGB5A1 = kCCTexture2DPixelFormat_RGB5A1,
|
||||||
|
kTexture2DPixelFormat_Default = kCCTexture2DPixelFormat_Default
|
||||||
} CCTexture2DPixelFormat;
|
} CCTexture2DPixelFormat;
|
||||||
|
|
||||||
/**
|
|
||||||
Extension to set the Min / Mag filter
|
|
||||||
*/
|
|
||||||
typedef struct _ccTexParams {
|
|
||||||
GLuint minFilter;
|
|
||||||
GLuint magFilter;
|
|
||||||
GLuint wrapS;
|
|
||||||
GLuint wrapT;
|
|
||||||
} ccTexParams;
|
|
||||||
|
|
||||||
|
|
||||||
class CCTexture2D : public CCObject
|
class CCTexture2D : public CCObject
|
||||||
{
|
{
|
||||||
/** pixel format of the texture */
|
CCTexture2DPixelFormat getPixelFormat();
|
||||||
CCTexture2DPixelFormat getPixelFormat();
|
|
||||||
/** width in pixels */
|
|
||||||
unsigned int getPixelsWide();
|
|
||||||
unsigned int getPixelsHigh();
|
|
||||||
|
|
||||||
/** texture name */
|
unsigned int getPixelsWide();
|
||||||
GLuint getName();
|
unsigned int getPixelsHigh();
|
||||||
|
|
||||||
/** content size */
|
GLuint getName();
|
||||||
CCSize getContentSizeInPixels();
|
|
||||||
/** texture max S */
|
|
||||||
void setMaxS(GLfloat val);
|
|
||||||
GLfloat getMaxS();
|
|
||||||
/** texture max T */
|
|
||||||
GLfloat getMaxT();
|
|
||||||
void setMaxT(GLfloat val);
|
|
||||||
|
|
||||||
bool getHasPremultipliedAlpha();
|
CCSize getContentSizeInPixels();
|
||||||
|
|
||||||
CCTexture2D();
|
void setMaxS(GLfloat val);
|
||||||
~CCTexture2D();
|
GLfloat getMaxS();
|
||||||
|
|
||||||
char * description(void);
|
GLfloat getMaxT();
|
||||||
|
void setMaxT(GLfloat val);
|
||||||
|
|
||||||
/** These functions are needed to create mutable textures */
|
bool getHasPremultipliedAlpha();
|
||||||
void releaseData(void *data);
|
|
||||||
void* keepData(void *data, unsigned int length);
|
|
||||||
|
|
||||||
/** Intializes with a texture2d with data */
|
void drawAtPoint(CCPoint point);
|
||||||
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize);
|
void drawInRect(CCRect rect);
|
||||||
|
|
||||||
|
CCSize getContentSize(void);
|
||||||
/** draws a texture at a given point */
|
|
||||||
void drawAtPoint(CCPoint point);
|
|
||||||
/** draws a texture inside a rect */
|
|
||||||
void drawInRect(CCRect rect);
|
|
||||||
|
|
||||||
/** Initializes a texture from a UIImage object */
|
void setTexParameters(ccTexParams* texParams);
|
||||||
bool initWithImage(CCImage * uiImage);
|
void setAntiAliasTexParameters();
|
||||||
/** Initializes a texture from a string with dimensions, alignment, font name and font size */
|
void setAliasTexParameters();
|
||||||
bool initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
void generateMipmap();
|
||||||
/** Initializes a texture from a string with font name and font size */
|
|
||||||
bool initWithString(const char *text, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
/** returns the content size of the texture in points */
|
int bitsPerPixelForFormat();
|
||||||
CCSize getContentSize(void);
|
|
||||||
|
|
||||||
|
|
||||||
void setTexParameters(ccTexParams* texParams);
|
|
||||||
|
|
||||||
void setAntiAliasTexParameters();
|
|
||||||
|
|
||||||
void setAliasTexParameters();
|
|
||||||
|
|
||||||
void generateMipmap();
|
|
||||||
|
|
||||||
int bitsPerPixelForFormat();
|
|
||||||
|
|
||||||
static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format);
|
|
||||||
static CCTexture2DPixelFormat defaultAlphaPixelFormat();
|
|
||||||
|
|
||||||
|
static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format);
|
||||||
|
static CCTexture2DPixelFormat defaultAlphaPixelFormat();
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,26 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCTextureAtlas : public CCObject
|
class CCTextureAtlas : public CCObject
|
||||||
{
|
{
|
||||||
unsigned int getTotalQuads();
|
unsigned int getTotalQuads();
|
||||||
unsigned int getCapacity();
|
unsigned int getCapacity();
|
||||||
|
|
||||||
CCTexture2D* getTexture();
|
void setTexture(CCTexture2D* val);
|
||||||
void setTexture(CCTexture2D* val);
|
CCTexture2D* getTexture();
|
||||||
/** Quads that are going to be rendered */
|
|
||||||
|
|
||||||
void setQuads(ccV3F_C4B_T2F_Quad* val);
|
void setQuads(ccV3F_C4B_T2F_Quad* val);
|
||||||
ccV3F_C4B_T2F_Quad* getQuads();
|
ccV3F_C4B_T2F_Quad* getQuads();
|
||||||
|
|
||||||
CCTextureAtlas();
|
void updateQuad(ccV3F_C4B_T2F_Quad* quad, unsigned int index);
|
||||||
~CCTextureAtlas();
|
void insertQuad(ccV3F_C4B_T2F_Quad* quad, unsigned int index);
|
||||||
|
void insertQuadFromIndex(unsigned int fromIndex, unsigned int newIndex);
|
||||||
|
void removeQuadAtIndex(unsigned int index);
|
||||||
|
void removeAllQuads();
|
||||||
|
bool resizeCapacity(unsigned int n);
|
||||||
|
void drawNumberOfQuads(unsigned int n);
|
||||||
|
void drawNumberOfQuads(unsigned int n, unsigned int start);
|
||||||
|
|
||||||
char * description();
|
void drawQuads();
|
||||||
|
|
||||||
static CCTextureAtlas * textureAtlasWithFile(const char* file , unsigned int capacity);
|
|
||||||
|
|
||||||
bool initWithFile(const char* file, unsigned int capacity);
|
|
||||||
|
|
||||||
static CCTextureAtlas * textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity);
|
|
||||||
|
|
||||||
|
|
||||||
bool initWithTexture(CCTexture2D *texture, unsigned int capacity);
|
|
||||||
|
|
||||||
|
|
||||||
void updateQuad(ccV3F_C4B_T2F_Quad* quad, unsigned int index);
|
|
||||||
|
|
||||||
|
|
||||||
void insertQuad(ccV3F_C4B_T2F_Quad* quad, unsigned int index);
|
|
||||||
|
|
||||||
|
|
||||||
void insertQuadFromIndex(unsigned int fromIndex, unsigned int newIndex);
|
|
||||||
|
|
||||||
void removeQuadAtIndex(unsigned int index);
|
|
||||||
|
|
||||||
|
|
||||||
void removeAllQuads();
|
|
||||||
|
|
||||||
bool resizeCapacity(unsigned int n);
|
|
||||||
|
|
||||||
|
|
||||||
void drawNumberOfQuads(unsigned int n);
|
|
||||||
|
|
||||||
void drawNumberOfQuads(unsigned int n, unsigned int start);
|
|
||||||
|
|
||||||
/** draws all the Atlas's Quads
|
|
||||||
*/
|
|
||||||
void drawQuads();
|
|
||||||
|
|
||||||
|
static CCTextureAtlas* textureAtlasWithFile(const char* file , unsigned int capacity);
|
||||||
|
static CCTextureAtlas* textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity);
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,76 +1,17 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCTextureCache : public CCObject
|
class CCTextureCache : public CCObject
|
||||||
{
|
{
|
||||||
|
CCTexture2D* addImage(const char* fileimage);
|
||||||
|
CCTexture2D* addUIImage(CCImage *image, const char *key);
|
||||||
|
CCTexture2D* textureForKey(const char* key);
|
||||||
|
|
||||||
CCTextureCache();
|
void removeAllTextures();
|
||||||
~CCTextureCache();
|
void removeUnusedTextures();
|
||||||
|
void removeTexture(CCTexture2D* texture);
|
||||||
|
void removeTextureForKey(const char *textureKeyName);
|
||||||
|
void dumpCachedTextureInfo();
|
||||||
|
|
||||||
char * description(void);
|
static CCTextureCache * sharedTextureCache();
|
||||||
|
|
||||||
/** Retruns ths shared instance of the cache */
|
|
||||||
static CCTextureCache * sharedTextureCache();
|
|
||||||
|
|
||||||
static void purgeSharedTextureCache();
|
|
||||||
|
|
||||||
CCTexture2D* addImage(const char* fileimage);
|
|
||||||
|
|
||||||
|
|
||||||
CCTexture2D* addUIImage(CCImage *image, const char *key);
|
|
||||||
void addImageAsync(const char *path, CCObject *target, SEL_CallFuncO selector);
|
|
||||||
|
|
||||||
CCTexture2D* textureForKey(const char* key);
|
|
||||||
|
|
||||||
void removeAllTextures();
|
|
||||||
|
|
||||||
|
|
||||||
void removeUnusedTextures();
|
|
||||||
|
|
||||||
void removeTexture(CCTexture2D* texture);
|
|
||||||
|
|
||||||
void removeTextureForKey(const char *textureKeyName);
|
|
||||||
|
|
||||||
void dumpCachedTextureInfo();
|
|
||||||
|
|
||||||
static void reloadAllTextures();
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
|
||||||
|
|
||||||
class VolatileTexture
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VolatileTexture(CCTexture2D *t);
|
|
||||||
~VolatileTexture();
|
|
||||||
|
|
||||||
static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format);
|
|
||||||
static void addStringTexture(CCTexture2D *tt, const char* text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
|
||||||
|
|
||||||
static void removeTexture(CCTexture2D *t);
|
|
||||||
static void reloadAllTextures();
|
static void reloadAllTextures();
|
||||||
|
static void purgeSharedTextureCache();
|
||||||
public:
|
|
||||||
static std::list<VolatileTexture*> textures;
|
|
||||||
static bool isReloading;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CCTexture2D *texture;
|
|
||||||
|
|
||||||
bool m_bIsString;
|
|
||||||
|
|
||||||
std::string m_strFileName;
|
|
||||||
CCImage::EImageFormat m_FmtImage;
|
|
||||||
|
|
||||||
CCSize m_size;
|
|
||||||
CCTextAlignment m_alignment;
|
|
||||||
std::string m_strFontName;
|
|
||||||
std::string m_strText;
|
|
||||||
float m_fFontSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,15 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
typedef std::map<std::string, int> StringToIntegerDictionary;
|
||||||
typedef std::map<std::string, int> StringToIntegerDictionary;
|
typedef std::pair<std::string, int> StringToIntegerPair;
|
||||||
typedef std::pair<std::string, int> StringToIntegerPair;
|
struct sImageTGA;
|
||||||
struct sImageTGA;
|
|
||||||
class CCTileMapAtlas : public CCAtlasNode
|
|
||||||
{
|
|
||||||
|
|
||||||
/** TileMap info */
|
class CCTileMapAtlas : public CCAtlasNode
|
||||||
struct sImageTGA* getTGAInfo();
|
{
|
||||||
void setTGAInfo(struct sImageTGA* val);
|
struct sImageTGA* getTGAInfo();
|
||||||
|
void setTGAInfo(struct sImageTGA* val);
|
||||||
CCTileMapAtlas();
|
|
||||||
~CCTileMapAtlas();
|
|
||||||
|
|
||||||
static CCTileMapAtlas * tileMapAtlasWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
|
||||||
|
|
||||||
bool initWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
|
||||||
|
|
||||||
|
|
||||||
void setTile(ccColor3B tile, ccGridSize position);
|
|
||||||
/** dealloc the map from memory */
|
|
||||||
void releaseMap();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}// namespace cocos2d
|
|
||||||
|
|
||||||
|
void setTile(ccColor3B tile, ccGridSize position);
|
||||||
|
void releaseMap();
|
||||||
|
|
||||||
|
static CCTileMapAtlas * tileMapAtlasWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
||||||
|
};
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
enum {
|
||||||
|
CCTOUCHBEGAN,
|
||||||
|
CCTOUCHMOVED,
|
||||||
|
CCTOUCHENDED,
|
||||||
|
CCTOUCHCANCELLED,
|
||||||
|
};
|
||||||
|
|
||||||
class CCTouch : public CCObject
|
class CCTouch : public CCObject
|
||||||
{
|
{
|
||||||
|
|
||||||
CCTouch();
|
|
||||||
CCTouch(int nViewId, float x, float y);
|
|
||||||
|
|
||||||
CCPoint locationInView(int nViewId);
|
CCPoint locationInView(int nViewId);
|
||||||
CCPoint previousLocationInView(int nViewId);
|
CCPoint previousLocationInView(int nViewId);
|
||||||
int view() { return m_nViewId; }
|
int view();
|
||||||
|
|
||||||
void SetTouchInfo(int nViewId, float x, float y);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEvent : public CCObject
|
class CCEvent : public CCObject
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCTouch;
|
|
||||||
class CCEvent;
|
|
||||||
class CCSet;
|
|
||||||
class CCTouchDispatcher;
|
|
||||||
|
|
||||||
class CCTouchDelegate
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
// optional
|
|
||||||
|
|
||||||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
|
|
||||||
// optional
|
|
||||||
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
|
|
||||||
void registerScriptTouchHandler(int eventType, const char* pszScriptFunctionName);
|
|
||||||
bool isScriptHandlerExist(int eventType);
|
|
||||||
void excuteScriptTouchHandler(int eventType, CCTouch *pTouch);
|
|
||||||
void excuteScriptTouchesHandler(int eventType, CCSet *pTouches);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
@brief
|
|
||||||
Using this type of delegate results in two benefits:
|
|
||||||
- 1. You don't need to deal with CCSets, the dispatcher does the job of splitting
|
|
||||||
them. You get exactly one UITouch per call.
|
|
||||||
- 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed
|
|
||||||
touches are sent only to the delegate(s) that claimed them. So if you get a move/
|
|
||||||
ended/cancelled update you're sure it's your touch. This frees you from doing a
|
|
||||||
lot of checks when doing multi-touch.
|
|
||||||
|
|
||||||
(The name TargetedTouchDelegate relates to updates "targeting" their specific
|
|
||||||
handler, without bothering the other handlers.)
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
class CCTargetedTouchDelegate : public CCTouchDelegate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/** Return YES to claim the touch.
|
|
||||||
@since v0
|
|
||||||
*/
|
|
||||||
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
|
|
||||||
// optional
|
|
||||||
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief
|
|
||||||
This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled).
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
class CCStandardTouchDelegate : public CCTouchDelegate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// optional
|
|
||||||
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
|
||||||
};
|
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
ccTouchSelectorBeganBit = 1 << 0,
|
|
||||||
ccTouchSelectorMovedBit = 1 << 1,
|
|
||||||
ccTouchSelectorEndedBit = 1 << 2,
|
|
||||||
ccTouchSelectorCancelledBit = 1 << 3,
|
|
||||||
ccTouchSelectorAllBits = ( ccTouchSelectorBeganBit | ccTouchSelectorMovedBit | ccTouchSelectorEndedBit | ccTouchSelectorCancelledBit),
|
|
||||||
} ccTouchSelectorFlag;
|
|
||||||
|
|
||||||
|
|
||||||
enum {
|
|
||||||
CCTOUCHBEGAN,
|
|
||||||
CCTOUCHMOVED,
|
|
||||||
CCTOUCHENDED,
|
|
||||||
CCTOUCHCANCELLED,
|
|
||||||
|
|
||||||
ccTouchMax,
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCSet;
|
|
||||||
class CCEvent;
|
|
||||||
|
|
||||||
struct ccTouchHandlerHelperData {
|
|
||||||
// we only use the type
|
|
||||||
// void (StandardTouchDelegate::*touchesSel)(CCSet*, CCEvent*);
|
|
||||||
// void (TargetedTouchDelegate::*touchSel)(NSTouch*, CCEvent*);
|
|
||||||
int m_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class EGLTouchDelegate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void touchesBegan(CCSet* touches, CCEvent* pEvent);
|
|
||||||
void touchesMoved(CCSet* touches, CCEvent* pEvent) ;
|
|
||||||
void touchesEnded(CCSet* touches, CCEvent* pEvent) ;
|
|
||||||
void touchesCancelled(CCSet* touches, CCEvent* pEvent) ;
|
|
||||||
|
|
||||||
~EGLTouchDelegate() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCTouchHandler;
|
|
||||||
struct _ccCArray;
|
|
||||||
/** @brief CCTouchDispatcher.
|
|
||||||
Singleton that handles all the touch events.
|
|
||||||
The dispatcher dispatches events to the registered TouchHandlers.
|
|
||||||
There are 2 different type of touch handlers:
|
|
||||||
- Standard Touch Handlers
|
|
||||||
- Targeted Touch Handlers
|
|
||||||
|
|
||||||
The Standard Touch Handlers work like the CocoaTouch touch handler: a set of touches is passed to the delegate.
|
|
||||||
On the other hand, the Targeted Touch Handlers only receive 1 touch at the time, and they can "swallow" touches (avoid the propagation of the event).
|
|
||||||
|
|
||||||
Firstly, the dispatcher sends the received touches to the targeted touches.
|
|
||||||
These touches can be swallowed by the Targeted Touch Handlers. If there are still remaining touches, then the remaining touches will be sent
|
|
||||||
to the Standard Touch Handlers.
|
|
||||||
|
|
||||||
@since v0.8.0
|
|
||||||
*/
|
|
||||||
class CCTouchDispatcher : public CCObject, public EGLTouchDelegate
|
|
||||||
{
|
|
||||||
|
|
||||||
~CCTouchDispatcher();
|
|
||||||
bool init(void);
|
|
||||||
CCTouchDispatcher();
|
|
||||||
|
|
||||||
|
|
||||||
/** Whether or not the events are going to be dispatched. Default: true */
|
|
||||||
bool isDispatchEvents(void);
|
|
||||||
void setDispatchEvents(bool bDispatchEvents);
|
|
||||||
|
|
||||||
/** Adds a standard touch delegate to the dispatcher's list.
|
|
||||||
See StandardTouchDelegate description.
|
|
||||||
IMPORTANT: The delegate will be retained.
|
|
||||||
*/
|
|
||||||
void addStandardDelegate(CCTouchDelegate *pDelegate, int nPriority);
|
|
||||||
|
|
||||||
/** Adds a targeted touch delegate to the dispatcher's list.
|
|
||||||
See TargetedTouchDelegate description.
|
|
||||||
IMPORTANT: The delegate will be retained.
|
|
||||||
*/
|
|
||||||
void addTargetedDelegate(CCTouchDelegate *pDelegate, int nPriority, bool bSwallowsTouches);
|
|
||||||
|
|
||||||
/** Removes a touch delegate.
|
|
||||||
The delegate will be released
|
|
||||||
*/
|
|
||||||
void removeDelegate(CCTouchDelegate *pDelegate);
|
|
||||||
|
|
||||||
/** Removes all touch delegates, releasing all the delegates */
|
|
||||||
void removeAllDelegates(void);
|
|
||||||
|
|
||||||
/** Changes the priority of a previously added delegate. The lower the number,
|
|
||||||
the higher the priority */
|
|
||||||
void setPriority(int nPriority, CCTouchDelegate *pDelegate);
|
|
||||||
|
|
||||||
void touches(CCSet *pTouches, CCEvent *pEvent, unsigned int uIndex);
|
|
||||||
|
|
||||||
void touchesBegan(CCSet* touches, CCEvent* pEvent);
|
|
||||||
void touchesMoved(CCSet* touches, CCEvent* pEvent);
|
|
||||||
void touchesEnded(CCSet* touches, CCEvent* pEvent);
|
|
||||||
void touchesCancelled(CCSet* touches, CCEvent* pEvent);
|
|
||||||
|
|
||||||
|
|
||||||
/** singleton of the CCTouchDispatcher */
|
|
||||||
static CCTouchDispatcher* sharedDispatcher();
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
|
@ -1,460 +1,163 @@
|
||||||
|
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
//static creation function macro
|
|
||||||
//c/c++ don't support object creation of using class name
|
|
||||||
//so, all classes need creation method.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Orientation Type used by some transitions
|
|
||||||
*/
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/// An horizontal orientation where the Left is nearer
|
/// An horizontal orientation where the Left is nearer
|
||||||
kOrientationLeftOver = 0,
|
kOrientationLeftOver = 0,
|
||||||
/// An horizontal orientation where the Right is nearer
|
/// An horizontal orientation where the Right is nearer
|
||||||
kOrientationRightOver = 1,
|
kOrientationRightOver = 1,
|
||||||
/// A vertical orientation where the Up is nearer
|
/// A vertical orientation where the Up is nearer
|
||||||
kOrientationUpOver = 0,
|
kOrientationUpOver = 0,
|
||||||
/// A vertical orientation where the Bottom is nearer
|
/// A vertical orientation where the Bottom is nearer
|
||||||
kOrientationDownOver = 1,
|
kOrientationDownOver = 1,
|
||||||
} tOrientation;
|
} tOrientation;
|
||||||
|
|
||||||
/** @brief Base class for CCTransition scenes
|
class CCTransitionSceneOriented : public CCScene
|
||||||
*/
|
|
||||||
class CCTransitionScene : public CCScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionSceneOriented* transitionWithDuration(ccTime t, CCScene* scene, tOrientation o);
|
||||||
CCTransitionScene();
|
|
||||||
~CCTransitionScene();
|
|
||||||
void draw();
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
void cleanup();
|
|
||||||
|
|
||||||
/** creates a base transition with duration and incoming scene */
|
|
||||||
static CCTransitionScene * transitionWithDuration(ccTime t, CCScene *scene);
|
|
||||||
|
|
||||||
/** initializes a transition with duration and incoming scene */
|
|
||||||
bool initWithDuration(ccTime t,CCScene* scene);
|
|
||||||
|
|
||||||
/** called after the transition finishes */
|
|
||||||
void finish(void);
|
|
||||||
|
|
||||||
/** used by some transitions to hide the outter scene */
|
|
||||||
void hideOutShowIn(void);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief A CCTransition that supports orientation like.
|
class CCTransitionRotoZoom : public CCScene
|
||||||
* Possible orientation: LeftOver, RightOver, UpOver, DownOver
|
|
||||||
*/
|
|
||||||
class CCTransitionSceneOriented : public CCTransitionScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionRotoZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSceneOriented();
|
|
||||||
~CCTransitionSceneOriented();
|
|
||||||
|
|
||||||
/** creates a base transition with duration and incoming scene */
|
|
||||||
static CCTransitionSceneOriented * transitionWithDuration(ccTime t,CCScene* scene, tOrientation orientation);
|
|
||||||
/** initializes a transition with duration and incoming scene */
|
|
||||||
bool initWithDuration(ccTime t,CCScene* scene,tOrientation orientation);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionRotoZoom:
|
class CCTransitionJumpZoom : public CCScene
|
||||||
Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
|
|
||||||
*/
|
|
||||||
class CCTransitionRotoZoom : public CCTransitionScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionJumpZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionRotoZoom();
|
|
||||||
~CCTransitionRotoZoom();
|
|
||||||
void onEnter();
|
|
||||||
static CCTransitionRotoZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionJumpZoom:
|
class CCTransitionMoveInL : public CCScene
|
||||||
Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
|
|
||||||
*/
|
|
||||||
class CCTransitionJumpZoom : public CCTransitionScene
|
|
||||||
{
|
{
|
||||||
CCTransitionJumpZoom();
|
static CCTransitionMoveInL* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
~CCTransitionJumpZoom();
|
|
||||||
void onEnter();
|
|
||||||
static CCTransitionJumpZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionMoveInL:
|
class CCTransitionMoveInR : public CCScene
|
||||||
Move in from to the left the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionMoveInL : public CCTransitionScene, public CCTransitionEaseScene
|
|
||||||
{
|
{
|
||||||
public:
|
static CCTransitionMoveInR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionMoveInL();
|
|
||||||
~CCTransitionMoveInL();
|
|
||||||
/** initializes the scenes */
|
|
||||||
void initScenes(void);
|
|
||||||
/** returns the action that will be performed */
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
|
|
||||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
static CCTransitionMoveInL* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionMoveInR:
|
class CCTransitionMoveInT : public CCScene
|
||||||
Move in from to the right the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionMoveInR : public CCTransitionMoveInL
|
|
||||||
{
|
{
|
||||||
public:
|
static CCTransitionMoveInT* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionMoveInR();
|
|
||||||
~CCTransitionMoveInR();
|
|
||||||
void initScenes();
|
|
||||||
static CCTransitionMoveInR* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionMoveInT:
|
class CCTransitionMoveInB : public CCScene
|
||||||
Move in from to the top the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionMoveInT : public CCTransitionMoveInL
|
|
||||||
{
|
{
|
||||||
public:
|
static CCTransitionMoveInB* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionMoveInT();
|
|
||||||
~CCTransitionMoveInT();
|
|
||||||
void initScenes();
|
|
||||||
static CCTransitionMoveInT* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionMoveInB:
|
class CCTransitionSlideInL : public CCScene
|
||||||
Move in from to the bottom the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionMoveInB : public CCTransitionMoveInL
|
|
||||||
{
|
{
|
||||||
CCTransitionMoveInB();
|
|
||||||
~CCTransitionMoveInB();
|
|
||||||
void initScenes();
|
|
||||||
static CCTransitionMoveInB* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief CCTransitionSlideInL:
|
|
||||||
Slide in the incoming scene from the left border.
|
|
||||||
*/
|
|
||||||
class CCTransitionSlideInL : public CCTransitionScene, public CCTransitionEaseScene
|
|
||||||
{
|
|
||||||
|
|
||||||
CCTransitionSlideInL();
|
|
||||||
~CCTransitionSlideInL();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
|
||||||
|
|
||||||
|
|
||||||
static CCTransitionSlideInL* transitionWithDuration(ccTime t, CCScene* scene);
|
static CCTransitionSlideInL* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionSlideInR:
|
class CCTransitionSlideInR : public CCScene
|
||||||
Slide in the incoming scene from the right border.
|
|
||||||
*/
|
|
||||||
class CCTransitionSlideInR : public CCTransitionSlideInL
|
|
||||||
{
|
{
|
||||||
public:
|
static CCTransitionSlideInR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSlideInR();
|
|
||||||
~CCTransitionSlideInR();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
static CCTransitionSlideInR* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionSlideInB:
|
class CCTransitionSlideInB : public CCScene
|
||||||
Slide in the incoming scene from the bottom border.
|
|
||||||
*/
|
|
||||||
class CCTransitionSlideInB : public CCTransitionSlideInL
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionSlideInB* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSlideInB();
|
|
||||||
~CCTransitionSlideInB();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
|
|
||||||
static CCTransitionSlideInB* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionSlideInT:
|
class CCTransitionSlideInT : public CCScene
|
||||||
Slide in the incoming scene from the top border.
|
|
||||||
*/
|
|
||||||
class CCTransitionSlideInT : public CCTransitionSlideInL
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionSlideInT* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSlideInT();
|
|
||||||
~CCTransitionSlideInT();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incomming and outgoing scene */
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
static CCTransitionSlideInT* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
class CCTransitionShrinkGrow : public CCScene
|
||||||
@brief Shrink the outgoing scene while grow the incoming scene
|
|
||||||
*/
|
|
||||||
class CCTransitionShrinkGrow : public CCTransitionScene , public CCTransitionEaseScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionShrinkGrow* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionShrinkGrow();
|
|
||||||
~CCTransitionShrinkGrow();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
|
||||||
static CCTransitionShrinkGrow* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFlipX:
|
class CCTransitionFlipX : public CCScene
|
||||||
Flips the screen horizontally.
|
|
||||||
The front face is the outgoing scene and the back face is the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionFlipX : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionFlipX();
|
|
||||||
~CCTransitionFlipX();
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFlipY:
|
class CCTransitionFlipY : public CCScene
|
||||||
Flips the screen vertically.
|
|
||||||
The front face is the outgoing scene and the back face is the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionFlipY : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionFlipY();
|
|
||||||
~CCTransitionFlipY();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFlipAngular:
|
class CCTransitionFlipAngular : public CCScene
|
||||||
Flips the screen half horizontally and half vertically.
|
|
||||||
The front face is the outgoing scene and the back face is the incoming scene.
|
|
||||||
*/
|
|
||||||
class CCTransitionFlipAngular : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionFlipAngular();
|
|
||||||
~CCTransitionFlipAngular();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionZoomFlipX:
|
class CCTransitionZoomFlipX : public CCScene
|
||||||
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 CCTransitionZoomFlipX : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionZoomFlipX();
|
|
||||||
~CCTransitionZoomFlipX();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionZoomFlipY:
|
class CCTransitionZoomFlipY : public CCScene
|
||||||
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 CCTransitionZoomFlipY : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionZoomFlipY();
|
|
||||||
~CCTransitionZoomFlipY();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionZoomFlipAngular:
|
class CCTransitionZoomFlipAngular : public CCScene
|
||||||
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 CCTransitionZoomFlipAngular : public CCTransitionSceneOriented
|
|
||||||
{
|
{
|
||||||
CCTransitionZoomFlipAngular();
|
|
||||||
~CCTransitionZoomFlipAngular();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFade:
|
class CCTransitionFade : public CCScene
|
||||||
Fade out the outgoing scene and then fade in the incoming scene.'''
|
|
||||||
*/
|
|
||||||
class CCTransitionFade : public CCTransitionScene
|
|
||||||
{
|
{
|
||||||
CCTransitionFade();
|
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
|
||||||
~CCTransitionFade();
|
|
||||||
|
|
||||||
/** creates the transition with a duration and with an RGB color
|
|
||||||
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
|
|
||||||
*/
|
|
||||||
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
|
|
||||||
/** initializes the transition with a duration and with an RGB color */
|
|
||||||
bool initWithDuration(ccTime t, CCScene*scene ,ccColor3B color);
|
|
||||||
|
|
||||||
bool initWithDuration(ccTime t,CCScene* scene);
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
class CCTransitionCrossFade : public CCScene
|
||||||
@brief CCTransitionCrossFade:
|
|
||||||
Cross fades two scenes using the CCRenderTexture object.
|
|
||||||
*/
|
|
||||||
class CCTransitionCrossFade : public CCTransitionScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionCrossFade* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionCrossFade();
|
|
||||||
~CCTransitionCrossFade();
|
|
||||||
|
|
||||||
void draw();
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
static CCTransitionCrossFade * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionTurnOffTiles:
|
class CCTransitionTurnOffTiles : public CCScene
|
||||||
Turn off the tiles of the outgoing scene in random order
|
|
||||||
*/
|
|
||||||
class CCTransitionTurnOffTiles : public CCTransitionScene ,public CCTransitionEaseScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionTurnOffTiles* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionTurnOffTiles();
|
|
||||||
~CCTransitionTurnOffTiles();
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
|
||||||
|
|
||||||
static CCTransitionTurnOffTiles * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionSplitCols:
|
class CCTransitionSplitCols : public CCScene
|
||||||
The odd columns goes upwards while the even columns goes downwards.
|
|
||||||
*/
|
|
||||||
class CCTransitionSplitCols : public CCTransitionScene , public CCTransitionEaseScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionSplitCols* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSplitCols();
|
|
||||||
~CCTransitionSplitCols();
|
|
||||||
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
void onEnter();
|
|
||||||
CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
|
||||||
|
|
||||||
static CCTransitionSplitCols * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionSplitRows:
|
class CCTransitionSplitRows : public CCScene
|
||||||
The odd rows goes to the left while the even rows goes to the right.
|
|
||||||
*/
|
|
||||||
class CCTransitionSplitRows : public CCTransitionSplitCols
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionSplitRows* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionSplitRows();
|
|
||||||
~CCTransitionSplitRows();
|
|
||||||
|
|
||||||
CCActionInterval* action(void);
|
|
||||||
static CCTransitionSplitRows * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFadeTR:
|
class CCTransitionFadeTR : public CCScene
|
||||||
Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
|
|
||||||
*/
|
|
||||||
class CCTransitionFadeTR : public CCTransitionScene , public CCTransitionEaseScene
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionFadeTR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionFadeTR();
|
|
||||||
~CCTransitionFadeTR();
|
|
||||||
CCActionInterval* actionWithSize(ccGridSize size);
|
|
||||||
void onEnter();
|
|
||||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
|
||||||
|
|
||||||
static CCTransitionFadeTR * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFadeBL:
|
class CCTransitionFadeBL : public CCScene
|
||||||
Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
|
|
||||||
*/
|
|
||||||
class CCTransitionFadeBL : public CCTransitionFadeTR
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionFadeBL* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionFadeBL();
|
|
||||||
~CCTransitionFadeBL();
|
|
||||||
CCActionInterval* actionWithSize(ccGridSize size);
|
|
||||||
|
|
||||||
static CCTransitionFadeBL * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFadeUp:
|
class CCTransitionFadeUp : public CCScene
|
||||||
* Fade the tiles of the outgoing scene from the bottom to the top.
|
|
||||||
*/
|
|
||||||
class CCTransitionFadeUp : public CCTransitionFadeTR
|
|
||||||
{
|
{
|
||||||
|
static CCTransitionFadeUp* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
CCTransitionFadeUp();
|
|
||||||
~CCTransitionFadeUp();
|
|
||||||
CCActionInterval* actionWithSize(ccGridSize size);
|
|
||||||
static CCTransitionFadeUp * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCTransitionFadeDown:
|
class CCTransitionFadeDown : public CCScene
|
||||||
* Fade the tiles of the outgoing scene from the top to the bottom.
|
|
||||||
*/
|
|
||||||
class CCTransitionFadeDown : public CCTransitionFadeTR
|
|
||||||
{
|
{
|
||||||
CCTransitionFadeDown();
|
static CCTransitionFadeDown* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
~CCTransitionFadeDown();
|
|
||||||
CCActionInterval* actionWithSize(ccGridSize size);
|
|
||||||
|
|
||||||
static CCTransitionFadeDown * transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
};
|
};
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
class CCTransitionRadialCCW : public CCScene
|
||||||
|
{
|
||||||
|
static CCTransitionRadialCCW* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCTransitionRadialCW : public CCScene
|
||||||
|
{
|
||||||
|
static CCTransitionRadialCW* transitionWithDuration(ccTime t, CCScene* scene);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCTransitionPageTurn : public CCScene
|
||||||
|
{
|
||||||
|
CCActionInterval* actionWithSize(ccGridSize vector);
|
||||||
|
|
||||||
|
static CCTransitionPageTurn* transitionWithDuration(ccTime t,CCScene* scene,bool backwards);
|
||||||
|
};
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCTransitionPageTurn : public CCTransitionScene
|
|
||||||
{
|
|
||||||
|
|
||||||
CCTransitionPageTurn();
|
|
||||||
~CCTransitionPageTurn();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a base transition with duration and incoming scene.
|
|
||||||
* If back is true then the effect is reversed to appear as if the incoming
|
|
||||||
* scene is being turned from left over the outgoing scene.
|
|
||||||
*/
|
|
||||||
static CCTransitionPageTurn* transitionWithDuration(ccTime t,CCScene* scene,bool backwards);
|
|
||||||
|
|
||||||
|
|
||||||
bool initWithDuration(ccTime t,CCScene* scene,bool backwards);
|
|
||||||
|
|
||||||
CCActionInterval* actionWithSize(ccGridSize vector);
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}//namespace cocos2d
|
|
|
@ -1,31 +0,0 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
|
|
||||||
class CCTransitionRadialCCW : public CCTransitionScene
|
|
||||||
{
|
|
||||||
|
|
||||||
CCTransitionRadialCCW(){}
|
|
||||||
~CCTransitionRadialCCW(){}
|
|
||||||
|
|
||||||
void onEnter();
|
|
||||||
void onExit();
|
|
||||||
|
|
||||||
static CCTransitionRadialCCW* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief A counter colock-wise radial transition to the next scene
|
|
||||||
*/
|
|
||||||
class CCTransitionRadialCW : public CCTransitionRadialCCW
|
|
||||||
{
|
|
||||||
|
|
||||||
CCTransitionRadialCW(){}
|
|
||||||
~CCTransitionRadialCW(){}
|
|
||||||
static CCTransitionRadialCW* transitionWithDuration(ccTime t, CCScene* scene);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
|
@ -1,29 +1,21 @@
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
class CCUserDefault
|
class CCUserDefault
|
||||||
{
|
{
|
||||||
|
// get value methods
|
||||||
|
bool getBoolForKey(const char* pKey);
|
||||||
|
int getIntegerForKey(const char* pKey);
|
||||||
|
float getFloatForKey(const char* pKey);
|
||||||
|
double getDoubleForKey(const char* pKey);
|
||||||
|
std::string getStringForKey(const char* pKey);
|
||||||
|
|
||||||
~CCUserDefault();
|
// set value methods
|
||||||
|
void setBoolForKey(const char* pKey, bool value);
|
||||||
// get value methods
|
void setIntegerForKey(const char* pKey, int value);
|
||||||
bool getBoolForKey(const char* pKey);
|
void setFloatForKey(const char* pKey, float value);
|
||||||
int getIntegerForKey(const char* pKey);
|
void setDoubleForKey(const char* pKey, double value);
|
||||||
float getFloatForKey(const char* pKey);
|
void setStringForKey(const char* pKey, std::string value);
|
||||||
double getDoubleForKey(const char* pKey);
|
|
||||||
std::string getStringForKey(const char* pKey);
|
|
||||||
|
|
||||||
// set value methods
|
|
||||||
void setBoolForKey(const char* pKey, bool value);
|
|
||||||
void setIntegerForKey(const char* pKey, int value);
|
|
||||||
void setFloatForKey(const char* pKey, float value);
|
|
||||||
void setDoubleForKey(const char* pKey, double value);
|
|
||||||
void setStringForKey(const char* pKey, std::string value);
|
|
||||||
|
|
||||||
static CCUserDefault* sharedUserDefault();
|
|
||||||
static void purgeSharedUserDefault();
|
|
||||||
const static std::string& getXMLFilePath();
|
|
||||||
|
|
||||||
|
static CCUserDefault* sharedUserDefault();
|
||||||
|
static void purgeSharedUserDefault();
|
||||||
|
const static std::string& getXMLFilePath();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,111 +1,26 @@
|
||||||
$using namespace cocos2d;
|
|
||||||
|
|
||||||
$pfile "CCNode.pkg"
|
$#include "LuaCocos2d.h"
|
||||||
|
|
||||||
$pfile "CCObject.pkg"
|
|
||||||
|
|
||||||
$pfile "CCParallaxNode.pkg"
|
|
||||||
|
|
||||||
$pfile "CCPointExtension.pkg"
|
|
||||||
|
|
||||||
$pfile "CCProgressTimer.pkg"
|
|
||||||
|
|
||||||
$pfile "CCRenderTexture.pkg"
|
|
||||||
|
|
||||||
$pfile "CCRibbon.pkg"
|
|
||||||
|
|
||||||
$pfile "CCScene.pkg"
|
|
||||||
|
|
||||||
$pfile "CCScheduler.pkg"
|
|
||||||
|
|
||||||
$pfile "CCSprite.pkg"
|
|
||||||
|
|
||||||
$pfile "CCSpriteBatchNode.pkg"
|
|
||||||
|
|
||||||
$pfile "CCSpriteFrame.pkg"
|
|
||||||
|
|
||||||
$pfile "CCSpriteFrameCache.pkg"
|
|
||||||
|
|
||||||
$pfile "CCString.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTextFieldTTF.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTexture2D.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTextureAtlas.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTextureCache.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTileMapAtlas.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTMXLayer.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTMXObjectGroup.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTMXTiledMap.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTMXXMLParser.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTouch.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTouchDispatcher.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTransition.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTransitionPageTurn.pkg"
|
|
||||||
|
|
||||||
$pfile "CCTransitionRadial.pkg"
|
|
||||||
|
|
||||||
$pfile "ccTypes.pkg"
|
|
||||||
|
|
||||||
$pfile "CCUserDefault.pkg"
|
|
||||||
|
|
||||||
$pfile "CCAccelerometer.pkg"
|
|
||||||
|
|
||||||
$pfile "CCAccelerometerDelegate.pkg"
|
|
||||||
|
|
||||||
$pfile "CCAction.pkg"
|
$pfile "CCAction.pkg"
|
||||||
|
|
||||||
$pfile "CCProtocols.pkg"
|
|
||||||
|
|
||||||
$pfile "CCSet.pkg"
|
|
||||||
|
|
||||||
$pfile "CCMutableArray.pkg"
|
|
||||||
$pfile "CCMutableDictionary.pkg"
|
|
||||||
|
|
||||||
|
|
||||||
$pfile "CCTouchDelegateProtocol.pkg"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$pfile "CCActionCamera.pkg"
|
$pfile "CCActionCamera.pkg"
|
||||||
$pfile "CCActionEase.pkg"
|
$pfile "CCActionEase.pkg"
|
||||||
$pfile "CCActionGrid3D.pkg"
|
|
||||||
$pfile "CCActionGrid.pkg"
|
$pfile "CCActionGrid.pkg"
|
||||||
$pfile "CCActionInstant.pkg"
|
$pfile "CCActionGrid3D.pkg"
|
||||||
$pfile "CCActionInterval.pkg"
|
|
||||||
$pfile "CCActionManager.pkg"
|
$pfile "CCActionManager.pkg"
|
||||||
$pfile "CCActionPageTurn3D.pkg"
|
$pfile "CCActionPageTurn3D.pkg"
|
||||||
$pfile "CCActionProgressTimer.pkg"
|
|
||||||
$pfile "CCActionTiledGrid.pkg"
|
$pfile "CCActionTiledGrid.pkg"
|
||||||
|
$pfile "CCAffineTransform.pkg"
|
||||||
$pfile "CCAnimation.pkg"
|
$pfile "CCAnimation.pkg"
|
||||||
$pfile "CCAnimationCache.pkg"
|
$pfile "CCAnimationCache.pkg"
|
||||||
$pfile "CCApplication.pkg"
|
$pfile "CCApplication.pkg"
|
||||||
$pfile "CCArray.pkg"
|
$pfile "CCArray.pkg"
|
||||||
$pfile "CCAtlasNode.pkg"
|
$pfile "CCAtlasNode.pkg"
|
||||||
$pfile "CCAutoreleasePool.pkg"
|
|
||||||
$pfile "CCCamera.pkg"
|
$pfile "CCCamera.pkg"
|
||||||
$pfile "ccConfig.pkg"
|
$pfile "CCCommon.pkg"
|
||||||
$pfile "CCDirector.pkg"
|
$pfile "CCDirector.pkg"
|
||||||
$pfile "CCDrawingPrimitives.pkg"
|
$pfile "CCDrawingPrimitives.pkg"
|
||||||
$pfile "CCEGLView.pkg"
|
$pfile "CCFileUtils.pkg"
|
||||||
$pfile "CCGeometry.pkg"
|
$pfile "CCGeometry.pkg"
|
||||||
$pfile "CCGL.pkg"
|
|
||||||
$pfile "CCIMEDelegate.pkg"
|
|
||||||
$pfile "CCIMEDispatcher.pkg"
|
|
||||||
$pfile "CCKeypadDelegate.pkg"
|
|
||||||
$pfile "CCKeypadDispatcher.pkg"
|
|
||||||
$pfile "CCLabelAtlas.pkg"
|
$pfile "CCLabelAtlas.pkg"
|
||||||
$pfile "CCLabelBMFont.pkg"
|
$pfile "CCLabelBMFont.pkg"
|
||||||
$pfile "CCLabelTTF.pkg"
|
$pfile "CCLabelTTF.pkg"
|
||||||
|
@ -113,7 +28,35 @@ $pfile "CCLayer.pkg"
|
||||||
$pfile "CCMenu.pkg"
|
$pfile "CCMenu.pkg"
|
||||||
$pfile "CCMenuItem.pkg"
|
$pfile "CCMenuItem.pkg"
|
||||||
$pfile "CCMotionStreak.pkg"
|
$pfile "CCMotionStreak.pkg"
|
||||||
|
$pfile "CCMutableArray.pkg"
|
||||||
$pfile "CCCommon.pkg"
|
$pfile "CCMutableDictionary.pkg"
|
||||||
|
$pfile "CCNode.pkg"
|
||||||
|
$pfile "CCObject.pkg"
|
||||||
|
$pfile "CCParallaxNode.pkg"
|
||||||
$pfile "CCParticleSystem.pkg"
|
$pfile "CCParticleSystem.pkg"
|
||||||
|
$pfile "CCPointExtension.pkg"
|
||||||
|
$pfile "CCProgressTimer.pkg"
|
||||||
|
$pfile "CCRenderTexture.pkg"
|
||||||
|
$pfile "CCRibbon.pkg"
|
||||||
|
$pfile "CCScene.pkg"
|
||||||
|
$pfile "CCScheduler.pkg"
|
||||||
|
$pfile "CCSprite.pkg"
|
||||||
|
$pfile "CCSpriteBatchNode.pkg"
|
||||||
|
$pfile "CCSpriteFrame.pkg"
|
||||||
|
$pfile "CCSpriteFrameCache.pkg"
|
||||||
|
$pfile "CCString.pkg"
|
||||||
|
$pfile "CCTextFieldTTF.pkg"
|
||||||
|
$pfile "CCTexture2D.pkg"
|
||||||
|
$pfile "CCTextureAtlas.pkg"
|
||||||
|
$pfile "CCTextureCache.pkg"
|
||||||
|
$pfile "CCTileMapAtlas.pkg"
|
||||||
|
$pfile "CCTMXLayer.pkg"
|
||||||
|
$pfile "CCTMXObjectGroup.pkg"
|
||||||
|
$pfile "CCTMXTiledMap.pkg"
|
||||||
|
$pfile "CCTMXXMLParser.pkg"
|
||||||
|
$pfile "CCTouch.pkg"
|
||||||
|
$pfile "CCTransition.pkg"
|
||||||
|
$pfile "ccTypes.pkg"
|
||||||
|
$pfile "CCUserDefault.pkg"
|
||||||
|
|
||||||
|
$pfile "SimpleAudioEngine.pkg"
|
||||||
|
|
|
@ -23,28 +23,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
namespace CocosDenshion {
|
|
||||||
|
|
||||||
/**
|
|
||||||
@class SimpleAudioEngine
|
|
||||||
@brief offer a VERY simple interface to play background music & sound effect
|
|
||||||
*/
|
|
||||||
class SimpleAudioEngine
|
class SimpleAudioEngine
|
||||||
{
|
{
|
||||||
SimpleAudioEngine();
|
|
||||||
~SimpleAudioEngine();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Get the shared Engine object,it will new one when first time be called
|
@brief Get the shared Engine object,it will new one when first time be called
|
||||||
*/
|
*/
|
||||||
static SimpleAudioEngine* sharedEngine();
|
static SimpleAudioEngine* sharedEngine();
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Release the shared Engine object
|
|
||||||
@warning It must be called before the application exit, or a memroy leak will be casued.
|
|
||||||
*/
|
|
||||||
static void end();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Set the zip file name
|
@brief Set the zip file name
|
||||||
@param pszZipFileName The relative path of the .zip file
|
@param pszZipFileName The relative path of the .zip file
|
||||||
|
@ -56,7 +41,7 @@ class SimpleAudioEngine
|
||||||
@param pszFilePath The path of the background music file,or the FileName of T_SoundResInfo
|
@param pszFilePath The path of the background music file,or the FileName of T_SoundResInfo
|
||||||
*/
|
*/
|
||||||
void preloadBackgroundMusic(const char* pszFilePath);
|
void preloadBackgroundMusic(const char* pszFilePath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Play background music
|
@brief Play background music
|
||||||
@param pszFilePath The path of the background music file,or the FileName of T_SoundResInfo
|
@param pszFilePath The path of the background music file,or the FileName of T_SoundResInfo
|
||||||
|
@ -116,12 +101,12 @@ class SimpleAudioEngine
|
||||||
*/
|
*/
|
||||||
void setEffectsVolume(float volume);
|
void setEffectsVolume(float volume);
|
||||||
|
|
||||||
// for sound effects
|
// for sound effects
|
||||||
/**
|
/**
|
||||||
@brief Play sound effect
|
@brief Play sound effect
|
||||||
@param pszFilePath The path of the effect file,or the FileName of T_SoundResInfo
|
@param pszFilePath The path of the effect file,or the FileName of T_SoundResInfo
|
||||||
@bLoop Whether to loop the effect playing, default value is false
|
@bLoop Whether to loop the effect playing, default value is false
|
||||||
*/
|
*/
|
||||||
unsigned int playEffect(const char* pszFilePath, bool bLoop = false);
|
unsigned int playEffect(const char* pszFilePath, bool bLoop = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +117,7 @@ class SimpleAudioEngine
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief preload a compressed audio file
|
@brief preload a compressed audio file
|
||||||
@details the compressed audio will be decode to wave, then write into an
|
@details the compressed audio will be decode to wave, then write into an
|
||||||
internal buffer in SimpleaudioEngine
|
internal buffer in SimpleaudioEngine
|
||||||
*/
|
*/
|
||||||
void preloadEffect(const char* pszFilePath);
|
void preloadEffect(const char* pszFilePath);
|
||||||
|
@ -143,5 +128,3 @@ class SimpleAudioEngine
|
||||||
*/
|
*/
|
||||||
void unloadEffect(const char* pszFilePath);
|
void unloadEffect(const char* pszFilePath);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace CocosDenshion
|
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
|
||||||
|
_is_functions = _is_functions or {}
|
||||||
|
_to_functions = _to_functions or {}
|
||||||
|
_push_functions = _push_functions or {}
|
||||||
|
|
||||||
|
local CCObjectTypes = {
|
||||||
|
"CCObject",
|
||||||
|
"CCAction",
|
||||||
|
"CCFiniteTimeAction",
|
||||||
|
"CCActionInstant",
|
||||||
|
"CCCallFunc",
|
||||||
|
"CCCallFuncN",
|
||||||
|
"CCCallFuncND",
|
||||||
|
"CCCallFuncO",
|
||||||
|
"CCFlipX",
|
||||||
|
"CCFlipY",
|
||||||
|
"CCHide",
|
||||||
|
"CCPlace",
|
||||||
|
"CCReuseGrid",
|
||||||
|
"CCShow",
|
||||||
|
"CCStopGrid",
|
||||||
|
"CCToggleVisibility",
|
||||||
|
"CCActionInterval",
|
||||||
|
"CCAccelAmplitude",
|
||||||
|
"CCAccelDeccelAmplitude",
|
||||||
|
"CCActionCamera",
|
||||||
|
"CCOrbitCamera",
|
||||||
|
"CCActionEase",
|
||||||
|
"CCEaseBackIn",
|
||||||
|
"CCEaseBackInOut",
|
||||||
|
"CCEaseBackOut",
|
||||||
|
"CCEaseBounce",
|
||||||
|
"CCEaseElastic",
|
||||||
|
"CCEaseExponentialIn",
|
||||||
|
"CCEaseExponentialInOut",
|
||||||
|
"CCEaseExponentialOut",
|
||||||
|
"CCEaseRateAction",
|
||||||
|
"CCEaseSineIn",
|
||||||
|
"CCEaseSineInOut",
|
||||||
|
"CCEaseSineOut",
|
||||||
|
"CCAnimate",
|
||||||
|
"CCBezierBy",
|
||||||
|
"CCBezierTo",
|
||||||
|
"CCBlink",
|
||||||
|
"CCDeccelAmplitude",
|
||||||
|
"CCDelayTime",
|
||||||
|
"CCFadeIn",
|
||||||
|
"CCFadeOut",
|
||||||
|
"CCFadeTo",
|
||||||
|
"CCGridAction",
|
||||||
|
"CCJumpBy",
|
||||||
|
"CCJumpTo",
|
||||||
|
"CCMoveTo",
|
||||||
|
"CCMoveBy",
|
||||||
|
"CCProgressFromTo",
|
||||||
|
"CCProgressTo",
|
||||||
|
"CCRepeat",
|
||||||
|
"CCRepeatForever",
|
||||||
|
"CCReverseTime",
|
||||||
|
"CCRotateBy",
|
||||||
|
"CCRotateTo",
|
||||||
|
"CCScaleTo",
|
||||||
|
"CCScaleBy",
|
||||||
|
"CCSequence",
|
||||||
|
"CCSkewTo",
|
||||||
|
"CCSkewBy",
|
||||||
|
"CCSpawn",
|
||||||
|
"CCTintBy",
|
||||||
|
"CCTintTo",
|
||||||
|
"CCActionManager",
|
||||||
|
"CCAnimation",
|
||||||
|
"CCAnimationCache",
|
||||||
|
"CCArray",
|
||||||
|
"CCAsyncObject",
|
||||||
|
"CCAutoreleasePool",
|
||||||
|
"CCBMFontConfiguration",
|
||||||
|
"CCCamera",
|
||||||
|
"CCConfiguration",
|
||||||
|
"CCData",
|
||||||
|
"CCDirector",
|
||||||
|
"CCDisplayLinkDirector",
|
||||||
|
"CCEvent",
|
||||||
|
"CCGrabber",
|
||||||
|
"CCGrid3D",
|
||||||
|
"CCTiledGrid3D",
|
||||||
|
"CCKeypadDispatcher",
|
||||||
|
"CCKeypadHandler",
|
||||||
|
"CCMutableArray",
|
||||||
|
"CCMutableDictionary",
|
||||||
|
"CCNode",
|
||||||
|
"CCAtlasNode",
|
||||||
|
"CCLabelAtlas",
|
||||||
|
"CCTileMapAtlas",
|
||||||
|
"CCLayer",
|
||||||
|
"CCLayerColor",
|
||||||
|
"CCLayerGradient",
|
||||||
|
"CCLayerMultiplex",
|
||||||
|
"CCMenu",
|
||||||
|
"CCMenuItem",
|
||||||
|
"CCMenuItemLabel",
|
||||||
|
"CCMenuItemAtlasFont",
|
||||||
|
"CCMenuItemFont",
|
||||||
|
"CCMenuItemSprite",
|
||||||
|
"CCMenuItemImage",
|
||||||
|
"CCMenuItemToggle",
|
||||||
|
"CCMotionStreak",
|
||||||
|
"CCParallaxNode",
|
||||||
|
"CCParticleSystem",
|
||||||
|
"CCParticleSystemPoint",
|
||||||
|
"CCParticleSystemQuad",
|
||||||
|
"CCProgressTimer",
|
||||||
|
"CCRenderTexture",
|
||||||
|
"CCRibbon",
|
||||||
|
"CCScene",
|
||||||
|
"CCTransitionScene",
|
||||||
|
"CCTransitionCrossFade",
|
||||||
|
"CCTransitionFade",
|
||||||
|
"CCTransitionFadeTR",
|
||||||
|
"CCTransitionFadeBL",
|
||||||
|
"CCTransitionFadeDown",
|
||||||
|
"CCTransitionFadeUp",
|
||||||
|
"CCTransitionJumpZoom",
|
||||||
|
"CCTransitionMoveInL",
|
||||||
|
"CCTransitionMoveInB",
|
||||||
|
"CCTransitionMoveInR",
|
||||||
|
"CCTransitionMoveInT",
|
||||||
|
"CCTransitionPageTurn",
|
||||||
|
"CCTransitionRadialCCW",
|
||||||
|
"CCTransitionRadialCW",
|
||||||
|
"CCTransitionRotoZoom",
|
||||||
|
"CCTransitionSceneOriented",
|
||||||
|
"CCTransitionFlipAngular",
|
||||||
|
"CCTransitionFlipX",
|
||||||
|
"CCTransitionFlipY",
|
||||||
|
"CCTransitionZoomFlipAngular",
|
||||||
|
"CCTransitionZoomFlipX",
|
||||||
|
"CCTransitionZoomFlipY",
|
||||||
|
"CCTransitionShrinkGrow",
|
||||||
|
"CCTransitionSlideInL",
|
||||||
|
"CCTransitionSlideInB",
|
||||||
|
"CCTransitionSlideInR",
|
||||||
|
"CCTransitionSlideInT",
|
||||||
|
"CCTransitionSplitCols",
|
||||||
|
"CCTransitionSplitRows",
|
||||||
|
"CCTransitionTurnOffTiles",
|
||||||
|
"CCSprite",
|
||||||
|
"CCLabelTTF",
|
||||||
|
"CCTextFieldTTF",
|
||||||
|
"CCSpriteBatchNode",
|
||||||
|
"CCLabelBMFont",
|
||||||
|
"CCTMXLayer",
|
||||||
|
"CCTMXTiledMap",
|
||||||
|
"CCPointObject",
|
||||||
|
"CCProjectionProtocol",
|
||||||
|
"CCRibbonSegment",
|
||||||
|
"CCScheduler",
|
||||||
|
"CCSet",
|
||||||
|
"CCSpriteFrame",
|
||||||
|
"CCSpriteFrameCache",
|
||||||
|
"CCString",
|
||||||
|
"CCTexture2D",
|
||||||
|
"CCTextureAtlas",
|
||||||
|
"CCTextureCache",
|
||||||
|
"CCTexturePVR",
|
||||||
|
"CCTimer",
|
||||||
|
"CCTMXLayerInfo",
|
||||||
|
"CCTMXMapInfo",
|
||||||
|
"CCTMXObjectGroup",
|
||||||
|
"CCTMXTilesetInfo",
|
||||||
|
"CCTouch",
|
||||||
|
"CCTouchDispatcher",
|
||||||
|
"CCTouchHandler",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- register CCObject types
|
||||||
|
for i = 1, #CCObjectTypes do
|
||||||
|
_push_functions[CCObjectTypes[i]] = "tolua_pushusertype_ccobject"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register LUA_FUNCTION type
|
||||||
|
_to_functions["LUA_FUNCTION"] = "tolua_ref_function"
|
||||||
|
_is_functions["LUA_FUNCTION"] = "tolua_isfunction"
|
||||||
|
|
||||||
|
|
||||||
|
function get_property_methods_hook(ptype, name)
|
||||||
|
if string.sub(ptype, 1, 2) == "CC" then
|
||||||
|
ptype = string.sub(ptype, 3)
|
||||||
|
end
|
||||||
|
return "get"..ptype, "set"..ptype
|
||||||
|
end
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
<project name="Cocos2d-xToLua" default="create-lua-bindings" basedir=".">
|
<project name="Cocos2d-xToLua" default="create-lua-bindings" basedir=".">
|
||||||
<description>
|
<description>
|
||||||
Utilises tolua++ to create the lua bindings to expose cocos2d-x functionality to lua
|
Utilises tolua++ to create the lua bindings to expose cocos2d-x functionality to lua
|
||||||
|
@ -7,58 +8,65 @@
|
||||||
<target name="cocos2d-x-bindings">
|
<target name="cocos2d-x-bindings">
|
||||||
<echo message="Calling tolua++" />
|
<echo message="Calling tolua++" />
|
||||||
<exec executable="${tolua++}">
|
<exec executable="${tolua++}">
|
||||||
<arg value="-tCocos2d"/>
|
<arg value="-L" />
|
||||||
|
<arg value="basic.lua" />
|
||||||
<arg value="-o"/>
|
<arg value="-o"/>
|
||||||
<arg value="LuaCocos2d.cpp"/>
|
<arg value="LuaCocos2d.cpp"/>
|
||||||
<arg value="Cocos2d.pkg"/>
|
<arg value="Cocos2d.pkg"/>
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="Patching resultant lua bindings" />
|
<echo message="Patching resultant lua bindings" />
|
||||||
|
|
||||||
<replace file="LuaCocos2d.cpp">
|
<replace file="LuaCocos2d.cpp">
|
||||||
<replacetoken><![CDATA[CCMutableArray<cocos2d::]]></replacetoken>
|
<replacetoken><![CDATA[tolua_pushusertype_ccobject(tolua_S,(void*)tolua_ret]]></replacetoken>
|
||||||
<replacevalue><![CDATA[cocos2d::CCMutableArray<]]></replacevalue>
|
<replacevalue><![CDATA[int uID = (tolua_ret) ? tolua_ret->m_uID : -1;
|
||||||
|
int* pLuaID = (tolua_ret) ? &tolua_ret->m_uLuaID : NULL;
|
||||||
|
tolua_pushusertype_ccobject(tolua_S, uID, pLuaID, (void*)tolua_ret]]></replacevalue>
|
||||||
</replace>
|
</replace>
|
||||||
<!-- I think this next patch is un-neccessary -->
|
|
||||||
<replace file="LuaCocos2d.cpp">
|
<replace file="LuaCocos2d.cpp">
|
||||||
<replacetoken><![CDATA[unsigned void* tolua_ret = (unsigned void*) self->getTiles();]]></replacetoken>
|
<replacetoken><![CDATA[unsigned void* tolua_ret = (unsigned void*) self->getTiles();]]></replacetoken>
|
||||||
<replacevalue><![CDATA[unsigned int* tolua_ret = (unsigned int*) self->getTiles();]]></replacevalue>
|
<replacevalue><![CDATA[unsigned int* tolua_ret = (unsigned int*) self->getTiles();]]></replacevalue>
|
||||||
</replace>
|
</replace>
|
||||||
|
|
||||||
<replace file="LuaCocos2d.cpp">
|
<replace file="LuaCocos2d.cpp">
|
||||||
<replacetoken><![CDATA[cocos2d::ccColor3B color = *((cocos2d::ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&(const cocos2d::ccColor3B)ccBLACK));]]></replacetoken>
|
<replacetoken><![CDATA[ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&(const ccColor3B)ccBLACK));]]></replacetoken>
|
||||||
<replacevalue><![CDATA[const cocos2d::ccColor3B clr = ccBLACK;
|
<replacevalue><![CDATA[const ccColor3B clr = ccBLACK;
|
||||||
cocos2d::ccColor3B color = *((cocos2d::ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&clr));]]></replacevalue>
|
ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&clr));]]></replacevalue>
|
||||||
</replace>
|
</replace>
|
||||||
<replace file="LuaCocos2d.cpp">
|
|
||||||
<replacetoken><![CDATA[tolua_constant(tolua_S,"CCSpriteIndexNotInitialized",cocos2d::CCSpriteIndexNotInitialized);]]></replacetoken>
|
|
||||||
<replacevalue><![CDATA[tolua_constant(tolua_S,"CCSpriteIndexNotInitialized",CCSpriteIndexNotInitialized);]]></replacevalue>
|
|
||||||
</replace>
|
|
||||||
<replace file="LuaCocos2d.cpp">
|
|
||||||
<replacetoken><![CDATA[/* Exported function */
|
|
||||||
TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);
|
|
||||||
|
|
||||||
#include "LuaCocos2d.h"
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA["LUA_FUNCTION",0,&tolua_err]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[&tolua_err]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
/* function to release collected object via destructor */]]></replacetoken>
|
<replace file="LuaCocos2d.cpp">
|
||||||
<replacevalue><![CDATA[using namespace cocos2d;
|
<replacetoken><![CDATA[LUA_FUNCTION funcID = *((LUA_FUNCTION*) tolua_ref_function(tolua_S,]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[unsigned int funcID = (tolua_ref_function(tolua_S,]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[#ifndef __cplusplus
|
||||||
|
#include "stdlib.h"
|
||||||
|
#endif
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "tolua++.h"
|
||||||
|
|
||||||
/* Exported function */
|
/* Exported function */
|
||||||
TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);
|
TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[#include <vector>
|
||||||
/* function to release collected object via destructor */]]></replacevalue>
|
#include <map>
|
||||||
</replace>
|
|
||||||
<replace file="LuaCocos2d.cpp">
|
|
||||||
<replacetoken><![CDATA[*/
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#include "stdlib.h"
|
|
||||||
#endif]]></replacetoken>
|
|
||||||
<replacevalue><![CDATA[*/
|
|
||||||
|
|
||||||
#include "LuaCocos2d.h"
|
#include "LuaCocos2d.h"
|
||||||
|
#include "tolua_fix.h"
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "CCRibbon.h"
|
||||||
|
#include "SimpleAudioEngine.h"
|
||||||
|
|
||||||
#ifndef __cplusplus
|
using namespace cocos2d;
|
||||||
#include "stdlib.h"
|
using namespace CocosDenshion;
|
||||||
#endif]]></replacevalue>
|
]]></replacevalue>
|
||||||
</replace>
|
</replace>
|
||||||
|
|
||||||
<echo message="Copying new bindings to target location" />
|
<echo message="Copying new bindings to target location" />
|
||||||
<move file="LuaCocos2d.cpp" todir="../../lua/cocos2dx_support/"/>
|
<move file="LuaCocos2d.cpp" todir="../../lua/cocos2dx_support/"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
|
||||||
|
<project name="Cocos2d-xToLua" default="create-lua-bindings" basedir=".">
|
||||||
|
<description>
|
||||||
|
Utilises tolua++ to create the lua bindings to expose cocos2d-x functionality to lua
|
||||||
|
</description>
|
||||||
|
<property name="tolua++" location="/usr/local/bin/tolua++"/>
|
||||||
|
|
||||||
|
<target name="cocos2d-x-bindings">
|
||||||
|
<echo message="Calling tolua++" />
|
||||||
|
<exec executable="${tolua++}">
|
||||||
|
<arg value="-L" />
|
||||||
|
<arg value="basic.lua" />
|
||||||
|
<arg value="-o"/>
|
||||||
|
<arg value="LuaCocos2d.cpp"/>
|
||||||
|
<arg value="Cocos2d.pkg"/>
|
||||||
|
</exec>
|
||||||
|
<echo message="Patching resultant lua bindings" />
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[tolua_pushusertype_ccobject(tolua_S,(void*)tolua_ret]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[int uID = (tolua_ret) ? tolua_ret->m_uID : -1;
|
||||||
|
int* pLuaID = (tolua_ret) ? &tolua_ret->m_uLuaID : NULL;
|
||||||
|
tolua_pushusertype_ccobject(tolua_S, uID, pLuaID, (void*)tolua_ret]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[unsigned void* tolua_ret = (unsigned void*) self->getTiles();]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[unsigned int* tolua_ret = (unsigned int*) self->getTiles();]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&(const ccColor3B)ccBLACK));]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[const ccColor3B clr = ccBLACK;
|
||||||
|
ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&clr));]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA["LUA_FUNCTION",0,&tolua_err]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[&tolua_err]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[LUA_FUNCTION funcID = *((LUA_FUNCTION*) tolua_ref_function(tolua_S,]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[unsigned int funcID = (tolua_ref_function(tolua_S,]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<replace file="LuaCocos2d.cpp">
|
||||||
|
<replacetoken><![CDATA[#ifndef __cplusplus
|
||||||
|
#include "stdlib.h"
|
||||||
|
#endif
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "tolua++.h"
|
||||||
|
|
||||||
|
/* Exported function */
|
||||||
|
TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);]]></replacetoken>
|
||||||
|
<replacevalue><![CDATA[#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include "LuaCocos2d.h"
|
||||||
|
#include "tolua_fix.h"
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "CCRibbon.h"
|
||||||
|
#include "SimpleAudioEngine.h"
|
||||||
|
|
||||||
|
using namespace cocos2d;
|
||||||
|
using namespace CocosDenshion;
|
||||||
|
]]></replacevalue>
|
||||||
|
</replace>
|
||||||
|
|
||||||
|
<echo message="Copying new bindings to target location" />
|
||||||
|
<move file="LuaCocos2d.cpp" todir="../../lua/cocos2dx_support/"/>
|
||||||
|
</target>
|
||||||
|
<target name="create-lua-bindings" depends="cocos2d-x-bindings" />
|
||||||
|
</project>
|
|
@ -1,73 +0,0 @@
|
||||||
|
|
||||||
#include "CCPlatformConfig.h"
|
|
||||||
|
|
||||||
#define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_FONT_LABEL_SUPPORT 1
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_DIRECTOR_FAST_FPS 1
|
|
||||||
|
|
||||||
#define CC_DIRECTOR_FPS_INTERVAL (0.5f)
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_DIRECTOR_DISPATCH_FAST_EVENTS 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD 1
|
|
||||||
|
|
||||||
#define CC_COCOSNODE_RENDER_SUBPIXEL 1
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_SPRITEBATCHNODE_RENDER_SUBPIXEL 1
|
|
||||||
|
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY)
|
|
||||||
#define CC_USES_VBO 0
|
|
||||||
#else
|
|
||||||
#define CC_USES_VBO 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_NODE_TRANSFORM_USING_AFFINE_MATRIX 1
|
|
||||||
|
|
||||||
#define CC_OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA 1
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_TEXTURE_NPOT_SUPPORT 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_RETINA_DISPLAY_SUPPORT 1
|
|
||||||
|
|
||||||
|
|
||||||
//#define CC_RETINA_DISPLAY_FILENAME_SUFFIX "-hd"
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_USE_LA88_LABELS_ON_NEON_ARCH 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_SPRITE_DEBUG_DRAW 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_SPRITEBATCHNODE_DEBUG_DRAW 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_LABELBMFONT_DEBUG_DRAW 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_LABELATLAS_DEBUG_DRAW 0
|
|
||||||
|
|
||||||
|
|
||||||
#define CC_ENABLE_PROFILERS 0
|
|
||||||
|
|
||||||
#if CC_RETINA_DISPLAY_SUPPORT
|
|
||||||
#define CC_IS_RETINA_DISPLAY_SUPPORTED 1
|
|
||||||
#else
|
|
||||||
#define CC_IS_RETINA_DISPLAY_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
typedef _lua_function LUA_FUNCTION;
|
||||||
|
|
||||||
typedef unsigned char GLubyte;
|
typedef unsigned char GLubyte;
|
||||||
typedef int GLint;
|
typedef int GLint;
|
||||||
typedef int GLsizei;
|
typedef int GLsizei;
|
||||||
|
@ -5,54 +8,44 @@ typedef unsigned char GLubyte;
|
||||||
typedef unsigned short GLushort;
|
typedef unsigned short GLushort;
|
||||||
typedef unsigned int GLuint;
|
typedef unsigned int GLuint;
|
||||||
typedef float GLfloat;
|
typedef float GLfloat;
|
||||||
namespace cocos2d {
|
|
||||||
|
|
||||||
/** RGB color composed of bytes 3 bytes
|
|
||||||
@since v0.8
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
typedef float ccTime;
|
typedef float ccTime;
|
||||||
typedef struct _ccColor3B
|
typedef struct _ccColor3B
|
||||||
{
|
{
|
||||||
GLubyte r;
|
GLubyte r;
|
||||||
GLubyte g;
|
GLubyte g;
|
||||||
GLubyte b;
|
GLubyte b;
|
||||||
} ccColor3B;
|
} ccColor3B;
|
||||||
|
|
||||||
//! helper macro that creates an ccColor3B type
|
static ccColor3B ccc3(const GLubyte r, const GLubyte g, const GLubyte b);
|
||||||
static ccColor3B ccc3(const GLubyte r, const GLubyte g, const GLubyte b);
|
|
||||||
/*
|
// static const ccColor3B ccWHITE;
|
||||||
//ccColor3B predefined colors
|
|
||||||
//! White color (255,255,255)
|
|
||||||
const ccColor3B ccWHITE;
|
|
||||||
//! Yellow color (255,255,0)
|
//! Yellow color (255,255,0)
|
||||||
const ccColor3B ccYELLOW;
|
// static const ccColor3B ccYELLOW;
|
||||||
//! Blue color (0,0,255)
|
//! Blue color (0,0,255)
|
||||||
const ccColor3B ccBLUE;
|
// static const ccColor3B ccBLUE;
|
||||||
//! Green Color (0,255,0)
|
//! Green Color (0,255,0)
|
||||||
const ccColor3B ccGREEN;
|
// static const ccColor3B ccGREEN;
|
||||||
//! Red Color (255,0,0,)
|
//! Red Color (255,0,0,)
|
||||||
const ccColor3B ccRED;
|
// static const ccColor3B ccRED;
|
||||||
//! Magenta Color (255,0,255)
|
//! Magenta Color (255,0,255)
|
||||||
const ccColor3B ccMAGENTA;
|
// static const ccColor3B ccMAGENTA;
|
||||||
//! Black Color (0,0,0)
|
//! Black Color (0,0,0)
|
||||||
const ccColor3B ccBLACK;
|
// static const ccColor3B ccBLACK;
|
||||||
//! Orange Color (255,127,0)
|
//! Orange Color (255,127,0)
|
||||||
const ccColor3B ccORANGE;
|
// static const ccColor3B ccORANGE;
|
||||||
//! Gray Color (166,166,166)
|
//! Gray Color (166,166,166)
|
||||||
const ccColor3B ccGRAY;
|
// static const ccColor3B ccGRAY;
|
||||||
*/
|
|
||||||
|
|
||||||
/** RGBA color composed of 4 bytes
|
/** RGBA color composed of 4 bytes
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccColor4B
|
typedef struct _ccColor4B
|
||||||
{
|
{
|
||||||
GLubyte r;
|
GLubyte r;
|
||||||
GLubyte g;
|
GLubyte g;
|
||||||
GLubyte b;
|
GLubyte b;
|
||||||
GLubyte a;
|
GLubyte a;
|
||||||
} ccColor4B;
|
} ccColor4B;
|
||||||
//! helper macro that creates an ccColor4B type
|
//! helper macro that creates an ccColor4B type
|
||||||
static ccColor4B ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o);
|
static ccColor4B ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o);
|
||||||
|
@ -62,10 +55,10 @@ static ccColor4B ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccColor4F {
|
typedef struct _ccColor4F {
|
||||||
GLfloat r;
|
GLfloat r;
|
||||||
GLfloat g;
|
GLfloat g;
|
||||||
GLfloat b;
|
GLfloat b;
|
||||||
GLfloat a;
|
GLfloat a;
|
||||||
} ccColor4F;
|
} ccColor4F;
|
||||||
|
|
||||||
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
|
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
|
||||||
|
@ -87,8 +80,8 @@ static bool ccc4FEqual(ccColor4F a, ccColor4F b);
|
||||||
*/
|
*/
|
||||||
typedef struct _ccVertex2F
|
typedef struct _ccVertex2F
|
||||||
{
|
{
|
||||||
GLfloat x;
|
GLfloat x;
|
||||||
GLfloat y;
|
GLfloat y;
|
||||||
} ccVertex2F;
|
} ccVertex2F;
|
||||||
|
|
||||||
static ccVertex2F vertex2(const float x, const float y);
|
static ccVertex2F vertex2(const float x, const float y);
|
||||||
|
@ -99,55 +92,55 @@ static ccVertex2F vertex2(const float x, const float y);
|
||||||
*/
|
*/
|
||||||
typedef struct _ccVertex3F
|
typedef struct _ccVertex3F
|
||||||
{
|
{
|
||||||
GLfloat x;
|
GLfloat x;
|
||||||
GLfloat y;
|
GLfloat y;
|
||||||
GLfloat z;
|
GLfloat z;
|
||||||
} ccVertex3F;
|
} ccVertex3F;
|
||||||
|
|
||||||
static ccVertex3F vertex3(const float x, const float y, const float z);
|
static ccVertex3F vertex3(const float x, const float y, const float z);
|
||||||
|
|
||||||
/** A texcoord composed of 2 floats: u, y
|
/** A texcoord composed of 2 floats: u, y
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccTex2F {
|
typedef struct _ccTex2F {
|
||||||
GLfloat u;
|
GLfloat u;
|
||||||
GLfloat v;
|
GLfloat v;
|
||||||
} ccTex2F;
|
} ccTex2F;
|
||||||
|
|
||||||
static ccTex2F tex2(const float u, const float v);
|
static ccTex2F tex2(const float u, const float v);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Point Sprite component
|
//! Point Sprite component
|
||||||
typedef struct _ccPointSprite
|
typedef struct _ccPointSprite
|
||||||
{
|
{
|
||||||
ccVertex2F pos; // 8 bytes
|
ccVertex2F pos; // 8 bytes
|
||||||
ccColor4B color; // 4 bytes
|
ccColor4B color; // 4 bytes
|
||||||
GLfloat size; // 4 bytes
|
GLfloat size; // 4 bytes
|
||||||
} ccPointSprite;
|
} ccPointSprite;
|
||||||
|
|
||||||
//! A 2D Quad. 4 * 2 floats
|
//! A 2D Quad. 4 * 2 floats
|
||||||
typedef struct _ccQuad2 {
|
typedef struct _ccQuad2 {
|
||||||
ccVertex2F tl;
|
ccVertex2F tl;
|
||||||
ccVertex2F tr;
|
ccVertex2F tr;
|
||||||
ccVertex2F bl;
|
ccVertex2F bl;
|
||||||
ccVertex2F br;
|
ccVertex2F br;
|
||||||
} ccQuad2;
|
} ccQuad2;
|
||||||
|
|
||||||
|
|
||||||
//! A 3D Quad. 4 * 3 floats
|
//! A 3D Quad. 4 * 3 floats
|
||||||
typedef struct _ccQuad3 {
|
typedef struct _ccQuad3 {
|
||||||
ccVertex3F bl;
|
ccVertex3F bl;
|
||||||
ccVertex3F br;
|
ccVertex3F br;
|
||||||
ccVertex3F tl;
|
ccVertex3F tl;
|
||||||
ccVertex3F tr;
|
ccVertex3F tr;
|
||||||
} ccQuad3;
|
} ccQuad3;
|
||||||
|
|
||||||
//! A 2D grid size
|
//! A 2D grid size
|
||||||
typedef struct _ccGridSize
|
typedef struct _ccGridSize
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
} ccGridSize;
|
} ccGridSize;
|
||||||
|
|
||||||
//! helper function to create a ccGridSize
|
//! helper function to create a ccGridSize
|
||||||
|
@ -156,86 +149,86 @@ static ccGridSize ccg(const int x, const int y);
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4B
|
//! a Point with a vertex point, a tex coord point and a color 4B
|
||||||
typedef struct _ccV2F_C4B_T2F
|
typedef struct _ccV2F_C4B_T2F
|
||||||
{
|
{
|
||||||
//! vertices (2F)
|
//! vertices (2F)
|
||||||
ccVertex2F vertices;
|
ccVertex2F vertices;
|
||||||
//! colors (4B)
|
//! colors (4B)
|
||||||
ccColor4B colors;
|
ccColor4B colors;
|
||||||
//! tex coords (2F)
|
//! tex coords (2F)
|
||||||
ccTex2F texCoords;
|
ccTex2F texCoords;
|
||||||
} ccV2F_C4B_T2F;
|
} ccV2F_C4B_T2F;
|
||||||
|
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4F
|
//! a Point with a vertex point, a tex coord point and a color 4F
|
||||||
typedef struct _ccV2F_C4F_T2F
|
typedef struct _ccV2F_C4F_T2F
|
||||||
{
|
{
|
||||||
//! vertices (2F)
|
//! vertices (2F)
|
||||||
ccVertex2F vertices;
|
ccVertex2F vertices;
|
||||||
//! colors (4F)
|
//! colors (4F)
|
||||||
ccColor4F colors;
|
ccColor4F colors;
|
||||||
//! tex coords (2F)
|
//! tex coords (2F)
|
||||||
ccTex2F texCoords;
|
ccTex2F texCoords;
|
||||||
} ccV2F_C4F_T2F;
|
} ccV2F_C4F_T2F;
|
||||||
|
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4B
|
//! a Point with a vertex point, a tex coord point and a color 4B
|
||||||
typedef struct _ccV3F_C4B_T2F
|
typedef struct _ccV3F_C4B_T2F
|
||||||
{
|
{
|
||||||
//! vertices (3F)
|
//! vertices (3F)
|
||||||
ccVertex3F vertices; // 12 bytes
|
ccVertex3F vertices; // 12 bytes
|
||||||
// char __padding__[4];
|
// char __padding__[4];
|
||||||
|
|
||||||
//! colors (4B)
|
//! colors (4B)
|
||||||
ccColor4B colors; // 4 bytes
|
ccColor4B colors; // 4 bytes
|
||||||
// char __padding2__[4];
|
// char __padding2__[4];
|
||||||
|
|
||||||
// tex coords (2F)
|
// tex coords (2F)
|
||||||
ccTex2F texCoords; // 8 byts
|
ccTex2F texCoords; // 8 byts
|
||||||
} ccV3F_C4B_T2F;
|
} ccV3F_C4B_T2F;
|
||||||
|
|
||||||
//! 4 ccVertex2FTex2FColor4B Quad
|
//! 4 ccVertex2FTex2FColor4B Quad
|
||||||
typedef struct _ccV2F_C4B_T2F_Quad
|
typedef struct _ccV2F_C4B_T2F_Quad
|
||||||
{
|
{
|
||||||
//! bottom left
|
//! bottom left
|
||||||
ccV2F_C4B_T2F bl;
|
ccV2F_C4B_T2F bl;
|
||||||
//! bottom right
|
//! bottom right
|
||||||
ccV2F_C4B_T2F br;
|
ccV2F_C4B_T2F br;
|
||||||
//! top left
|
//! top left
|
||||||
ccV2F_C4B_T2F tl;
|
ccV2F_C4B_T2F tl;
|
||||||
//! top right
|
//! top right
|
||||||
ccV2F_C4B_T2F tr;
|
ccV2F_C4B_T2F tr;
|
||||||
} ccV2F_C4B_T2F_Quad;
|
} ccV2F_C4B_T2F_Quad;
|
||||||
|
|
||||||
//! 4 ccVertex3FTex2FColor4B
|
//! 4 ccVertex3FTex2FColor4B
|
||||||
typedef struct _ccV3F_C4B_T2F_Quad
|
typedef struct _ccV3F_C4B_T2F_Quad
|
||||||
{
|
{
|
||||||
//! top left
|
//! top left
|
||||||
ccV3F_C4B_T2F tl;
|
ccV3F_C4B_T2F tl;
|
||||||
//! bottom left
|
//! bottom left
|
||||||
ccV3F_C4B_T2F bl;
|
ccV3F_C4B_T2F bl;
|
||||||
//! top right
|
//! top right
|
||||||
ccV3F_C4B_T2F tr;
|
ccV3F_C4B_T2F tr;
|
||||||
//! bottom right
|
//! bottom right
|
||||||
ccV3F_C4B_T2F br;
|
ccV3F_C4B_T2F br;
|
||||||
} ccV3F_C4B_T2F_Quad;
|
} ccV3F_C4B_T2F_Quad;
|
||||||
|
|
||||||
//! 4 ccVertex2FTex2FColor4F Quad
|
//! 4 ccVertex2FTex2FColor4F Quad
|
||||||
typedef struct _ccV2F_C4F_T2F_Quad
|
typedef struct _ccV2F_C4F_T2F_Quad
|
||||||
{
|
{
|
||||||
//! bottom left
|
//! bottom left
|
||||||
ccV2F_C4F_T2F bl;
|
ccV2F_C4F_T2F bl;
|
||||||
//! bottom right
|
//! bottom right
|
||||||
ccV2F_C4F_T2F br;
|
ccV2F_C4F_T2F br;
|
||||||
//! top left
|
//! top left
|
||||||
ccV2F_C4F_T2F tl;
|
ccV2F_C4F_T2F tl;
|
||||||
//! top right
|
//! top right
|
||||||
ccV2F_C4F_T2F tr;
|
ccV2F_C4F_T2F tr;
|
||||||
} ccV2F_C4F_T2F_Quad;
|
} ccV2F_C4F_T2F_Quad;
|
||||||
|
|
||||||
//! Blend Function used for textures
|
//! Blend Function used for textures
|
||||||
typedef struct _ccBlendFunc
|
typedef struct _ccBlendFunc
|
||||||
{
|
{
|
||||||
//! source blend function
|
//! source blend function
|
||||||
GLenum src;
|
GLenum src;
|
||||||
//! destination blend function
|
//! destination blend function
|
||||||
GLenum dst;
|
GLenum dst;
|
||||||
} ccBlendFunc;
|
} ccBlendFunc;
|
||||||
|
|
||||||
//! delta time type
|
//! delta time type
|
||||||
|
@ -243,13 +236,9 @@ typedef struct _ccBlendFunc
|
||||||
|
|
||||||
//typedef double ccTime;
|
//typedef double ccTime;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CCTextAlignmentLeft,
|
CCTextAlignmentLeft,
|
||||||
CCTextAlignmentCenter,
|
CCTextAlignmentCenter,
|
||||||
CCTextAlignmentRight,
|
CCTextAlignmentRight,
|
||||||
} CCTextAlignment;
|
} CCTextAlignment;
|
||||||
|
|
||||||
}//namespace cocos2d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
d2ec87961c13d8ae29e5d9bd84aec0a4465c668c
|
|
Loading…
Reference in New Issue