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 {
|
||||
kCCActionTagInvalid = -1,
|
||||
};
|
||||
class CCAction : public CCObject
|
||||
{
|
||||
// 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
|
||||
{
|
||||
|
||||
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);
|
||||
// static CCAction* action();
|
||||
};
|
||||
|
||||
void setOriginalTarget(CCNode *pOriginalTarget);
|
||||
int getTag(void);
|
||||
void setTag(int nTag);
|
||||
static CCAction* action();
|
||||
|
||||
};
|
||||
class CCActionInterval : public CCAction
|
||||
{
|
||||
// ccTime getElapsed(void);
|
||||
// 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
|
||||
{
|
||||
CCFiniteTimeAction();
|
||||
~CCFiniteTimeAction(){}
|
||||
//! get duration in seconds of the action
|
||||
ccTime getDuration(void);
|
||||
//! set duration in seconds of the action
|
||||
void setDuration(ccTime duration);
|
||||
// CCActionInstant
|
||||
class CCShow : public CCAction
|
||||
{
|
||||
static CCAction* action();
|
||||
};
|
||||
|
||||
|
||||
virtual CCFiniteTimeAction* reverse(void);
|
||||
};
|
||||
class CCHide : public CCAction
|
||||
{
|
||||
static CCAction* action();
|
||||
};
|
||||
|
||||
class CCToggleVisibility : public CCAction
|
||||
{
|
||||
static CCAction* action();
|
||||
};
|
||||
|
||||
class CCActionInterval;
|
||||
class CCRepeatForever;
|
||||
class CCFlipX : public CCAction
|
||||
{
|
||||
static CCAction* actionWithFlipX(bool x);
|
||||
};
|
||||
|
||||
class CCSpeed : public CCAction
|
||||
{
|
||||
public:
|
||||
CCSpeed();
|
||||
virtual ~CCSpeed(void);
|
||||
class CCFlipY : public CCAction
|
||||
{
|
||||
static CCAction* actionWithFlipY(bool y);
|
||||
};
|
||||
|
||||
float getSpeed(void);
|
||||
/** alter the speed of the inner function in runtime */
|
||||
void setSpeed(float fSpeed);
|
||||
|
||||
/** 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
|
||||
class CCPlace : public CCAction //<NSCopying>
|
||||
{
|
||||
static CCAction* actionWithPosition(CCPoint pos);
|
||||
};
|
||||
|
|
|
@ -1,33 +1,12 @@
|
|||
|
||||
#include "CCActionInterval.h"
|
||||
class CCActionCamera : public CCActionInterval
|
||||
{
|
||||
void startWithTarget(CCNode *pTarget);
|
||||
};
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
class CCCamera;
|
||||
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
|
||||
class CCOrbitCamera : public CCActionCamera
|
||||
{
|
||||
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
||||
|
||||
static CCOrbitCamera * actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||
};
|
||||
|
|
|
@ -1,265 +1,114 @@
|
|||
|
||||
#include "CCActionInterval.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
class CCObject;
|
||||
class CCZone;
|
||||
|
||||
class CCActionEase : public CCActionInterval
|
||||
{
|
||||
bool initWithAction(CCActionInterval *pAction);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(ccTime time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
static CCActionEase* actionWithAction(CCActionInterval *pAction);
|
||||
};
|
||||
|
||||
|
||||
class CCEaseRateAction : public CCActionEase
|
||||
{
|
||||
public:
|
||||
~CCEaseRateAction(void);
|
||||
|
||||
/** set rate value for the actions */
|
||||
void setRate(float rate);
|
||||
/** get rate value for the actions */
|
||||
float getRate(void);
|
||||
|
||||
/** Initializes the action with the inner action and the rate parameter */
|
||||
bool initWithAction(CCActionInterval *pAction, float fRate);
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
/**
|
||||
@brief CCEaseIn action with a rate
|
||||
*/
|
||||
class CCEaseIn : public CCEaseRateAction
|
||||
{
|
||||
|
||||
public:
|
||||
void update(ccTime time);
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
*/
|
||||
class CCEaseOut : public CCEaseRateAction
|
||||
{
|
||||
void update(ccTime time);
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
|
||||
class CCEaseInOut : public CCEaseRateAction
|
||||
{
|
||||
public:
|
||||
virtual void update(ccTime time);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** Creates the action with the inner action and the rate parameter */
|
||||
static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
/**
|
||||
@brief CCEase Exponential In
|
||||
*/
|
||||
class CCEaseExponentialIn : public CCActionEase
|
||||
{
|
||||
|
||||
virtual void update(ccTime time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
|
||||
class CCEaseExponentialOut : public CCActionEase
|
||||
{
|
||||
|
||||
virtual void update(ccTime time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Ease Exponential InOut
|
||||
*/
|
||||
class CCEaseExponentialInOut : public CCActionEase
|
||||
{
|
||||
|
||||
virtual void update(ccTime time);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CCEaseSineIn : public CCActionEase
|
||||
{
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
class CCActionEase : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||
};
|
||||
|
||||
class CCEaseRateAction : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
class CCEaseIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
class CCEaseOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
class CCEaseInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction, float fRate);
|
||||
};
|
||||
|
||||
class CCEaseExponentialIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseExponentialOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseExponentialInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseSineIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseSineOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseSineInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseElastic : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||
};
|
||||
|
||||
class CCEaseElasticIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||
};
|
||||
|
||||
class CCEaseElasticOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||
};
|
||||
|
||||
class CCEaseElasticInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction);
|
||||
static CCActionInterval* actionWithAction(CCActionInterval *pAction, float fPeriod);
|
||||
};
|
||||
|
||||
class CCEaseBounce : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBounceIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBounceOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBounceInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBackIn : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBackOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
class CCEaseBackInOut : public CCActionInterval
|
||||
{
|
||||
static CCActionInterval* actionWithAction(CCActionInterval* pAction);
|
||||
};
|
||||
|
|
|
@ -1,157 +1,41 @@
|
|||
|
||||
namespace cocos2d
|
||||
class CCGridAction : public CCActionInterval
|
||||
{
|
||||
class CCGridBase;
|
||||
CCGridBase* getGrid(void);
|
||||
|
||||
/** @brief Base class for Grid actions */
|
||||
class CCGridAction : public CCActionInterval
|
||||
{
|
||||
public:
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
|
||||
/** initializes the action with size and duration */
|
||||
virtual bool initWithSize(ccGridSize gridSize, ccTime duration);
|
||||
/** returns the grid */
|
||||
virtual CCGridBase* getGrid(void);
|
||||
class CCAccelDeccelAmplitude : public CCActionInterval
|
||||
{
|
||||
float getRate(void);
|
||||
void setRate(float fRate);
|
||||
|
||||
public:
|
||||
/** creates the action with size and duration */
|
||||
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
||||
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||
};
|
||||
|
||||
};
|
||||
class CCAccelAmplitude : public CCActionInterval
|
||||
{
|
||||
float getRate(void);
|
||||
void setRate(float fRate);
|
||||
|
||||
/**
|
||||
@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);
|
||||
static CCAccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
static CCGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
class CCDeccelAmplitude : public CCActionInterval
|
||||
{
|
||||
float getRate(void);
|
||||
void setRate(float fRate);
|
||||
|
||||
|
||||
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
|
||||
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
|
||||
};
|
||||
|
||||
class CCStopGrid : public CCActionInstant
|
||||
{
|
||||
static CCStopGrid* action(void);
|
||||
};
|
||||
|
||||
class CCReuseGrid : public CCActionInstant
|
||||
{
|
||||
static CCReuseGrid* actionWithTimes(int times);
|
||||
};
|
||||
|
|
|
@ -1,150 +1,83 @@
|
|||
|
||||
|
||||
#include "CCActionGrid.h"
|
||||
|
||||
namespace cocos2d
|
||||
class CCWaves3D : public CCGrid3DAction
|
||||
{
|
||||
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);
|
||||
void setAmplitude(float fAmplitude);
|
||||
float getAmplitudeRate(void);
|
||||
void setAmplitudeRate(float fAmplitudeRate);
|
||||
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||
class CCFlipX3D : public CCGrid3DAction
|
||||
{
|
||||
static CCFlipX3D* actionWithDuration(ccTime duration);
|
||||
};
|
||||
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
void update(ccTime time);
|
||||
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||
class CCFlipY3D : public CCFlipX3D
|
||||
{
|
||||
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);
|
||||
bool initWithSize(ccGridSize gridSize, ccTime duration);
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
void update(ccTime time);
|
||||
static CCFlipX3D* actionWithDuration(ccTime duration);
|
||||
};
|
||||
class CCShaky3D : public CCGrid3DAction
|
||||
{
|
||||
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, 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);
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
static CCFlipY3D* actionWithDuration(ccTime duration);
|
||||
};
|
||||
class CCWaves : public CCGrid3DAction
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
float getLensEffect(void);
|
||||
void setLensEffect(float fLensEffect);
|
||||
|
||||
CCPoint getPosition(void);
|
||||
void setPosition(CCPoint position);
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
}
|
||||
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);
|
||||
|
||||
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"
|
||||
#include "CCMutableArray.h"
|
||||
#include "CCObject.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
struct _hashElement;
|
||||
|
||||
class CCActionManager : public CCObject
|
||||
class CCActionManager : public CCObject
|
||||
{
|
||||
public:
|
||||
CCActionManager(void);
|
||||
bool init(void);
|
||||
void addAction(CCAction *pAction, CCNode *pTarget, bool paused);
|
||||
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);
|
||||
void removeAllActions(void);
|
||||
void removeAllActionsFromTarget(CCObject *pTarget);
|
||||
void removeAction(CCAction *pAction);
|
||||
void removeActionByTag(int tag, CCObject *pTarget);
|
||||
|
||||
int numberOfRunningActionsInTarget(CCObject *pTarget);
|
||||
|
||||
void pauseTarget(CCObject *pTarget);
|
||||
void resumeTarget(CCObject *pTarget);
|
||||
|
||||
static CCActionManager* sharedManager(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
|
||||
#include "CCActionGrid3D.h"
|
||||
|
||||
namespace cocos2d
|
||||
class CCPageTurn3D : public CCGrid3DAction
|
||||
{
|
||||
|
||||
class CCPageTurn3D : public CCGrid3DAction
|
||||
{
|
||||
void update(ccTime time);
|
||||
static CCPageTurn3D* actionWithSize(ccGridSize gridSize, 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"
|
||||
|
||||
namespace cocos2d
|
||||
class CCShakyTiles3D : public CCTiledGrid3DAction
|
||||
{
|
||||
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
|
||||
class CCShakyTiles3D : public CCTiledGrid3DAction
|
||||
{
|
||||
bool initWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,ccTime duration);
|
||||
class CCShatteredTiles3D : public CCTiledGrid3DAction
|
||||
{
|
||||
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
void update(ccTime time);
|
||||
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,
|
||||
ccTime duration);
|
||||
class CCShuffleTiles : public CCTiledGrid3DAction
|
||||
{
|
||||
void shuffle(int *pArray, int nLen);
|
||||
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);
|
||||
void update(ccTime time);
|
||||
class CCFadeOutUpTiles : public CCFadeOutTRTiles
|
||||
{
|
||||
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,
|
||||
ccTime duration);
|
||||
};
|
||||
class CCTurnOffTiles : public CCTiledGrid3DAction
|
||||
{
|
||||
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);
|
||||
void shuffle(int *pArray, int nLen);
|
||||
ccGridSize getDelta(ccGridSize pos);
|
||||
void placeTile(ccGridSize pos, Tile *t);
|
||||
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(ccTime time);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
||||
};
|
||||
class CCJumpTiles3D : public CCTiledGrid3DAction
|
||||
{
|
||||
float getAmplitude(void);
|
||||
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
|
||||
{
|
||||
|
||||
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 CCSplitRows : public CCTiledGrid3DAction
|
||||
{
|
||||
static CCSplitRows* actionWithRows(int nRows, ccTime duration);
|
||||
};
|
||||
|
||||
class CCSplitCols : public CCTiledGrid3DAction
|
||||
{
|
||||
static CCSplitCols* actionWithCols(int nCols, ccTime duration);
|
||||
};
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
namespace cocos2d {
|
||||
|
||||
struct CCAffineTransform {
|
||||
CGFloat a, b, c, d;
|
||||
CGFloat tx, ty;
|
||||
CGFloat a, b, c, d;
|
||||
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);
|
||||
|
||||
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
||||
CCPoint CCPointApplyAffineTransform(CCPoint point, 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);
|
||||
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
|
||||
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
|
||||
|
||||
//extern const CCAffineTransform CCAffineTransformIdentity;
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1,45 +1,20 @@
|
|||
|
||||
#include "CCPlatformConfig.h"
|
||||
#include "CCObject.h"
|
||||
#include "CCMutableArray.h"
|
||||
#include "CCGeometry.h"
|
||||
#include <string>
|
||||
class CCAnimation : public CCObject
|
||||
{
|
||||
const char* getName(void);
|
||||
void setName(const char *pszName);
|
||||
|
||||
namespace cocos2d {
|
||||
float getDelay(void);
|
||||
void setDelay(float fDelay);
|
||||
|
||||
class CCSpriteFrame;
|
||||
class CCTexture2D;
|
||||
|
||||
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);
|
||||
CCMutableArray<CCSpriteFrame*>* getFrames(void);
|
||||
void setFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
void addFrameWithFileName(const char *pszFileName);
|
||||
|
||||
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
|
||||
void addFrame(CCSpriteFrame *pFrame);
|
||||
void addFrameWithFileName(const char *pszFileName);
|
||||
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
||||
|
||||
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"
|
||||
#include "CCMutableDictionary.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace cocos2d
|
||||
class CCAnimationCache : public CCObject
|
||||
{
|
||||
class CCAnimation;
|
||||
void addAnimation(CCAnimation *animation, const char * name);
|
||||
void removeAnimationByName(const char* name);
|
||||
CCAnimation* animationByName(const char* name);
|
||||
|
||||
/** Singleton that manages the Animations.
|
||||
It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
}
|
||||
static CCAnimationCache* sharedAnimationCache(void);
|
||||
static void purgeSharedAnimationCache(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"
|
||||
|
||||
|
||||
|
||||
namespace cocos2d
|
||||
class CCArray : public CCObject
|
||||
{
|
||||
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();
|
||||
static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||
static CCArray* arrayWithArray(CCArray* otherArray);
|
||||
bool containsObject(CCObject* object);
|
||||
|
||||
bool init();
|
||||
bool initWithCapacity(unsigned int capacity);
|
||||
bool initWithArray(CCArray* otherArray);
|
||||
void addObject(CCObject* object);
|
||||
void addObjectsFromArray(CCArray* otherArray);
|
||||
void insertObject(CCObject* object, unsigned int index);
|
||||
|
||||
unsigned int count();
|
||||
unsigned int capacity();
|
||||
unsigned int indexOfObject(CCObject* object);
|
||||
CCObject* objectAtIndex(unsigned int index);
|
||||
CCObject* lastObject();
|
||||
CCObject* randomObject();
|
||||
bool containsObject(CCObject* object);
|
||||
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 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 exchangeObjectAtIndex(unsigned int index1, unsigned int index2);
|
||||
void reverseObjects();
|
||||
void reduceMemoryFootprint();
|
||||
|
||||
public:
|
||||
ccArray* data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void reduceMemoryFootprint();
|
||||
|
||||
static CCArray* array();
|
||||
static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||
static CCArray* arrayWithArray(CCArray* otherArray);
|
||||
};
|
||||
|
|
|
@ -1,28 +1,9 @@
|
|||
|
||||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "ccTypes.h"
|
||||
|
||||
namespace cocos2d {
|
||||
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
|
||||
|
||||
|
||||
class CCAtlasNode : public CCNode
|
||||
{
|
||||
void updateAtlasValues();
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D *texture);
|
||||
|
||||
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"
|
||||
#include "ccMacros.h"
|
||||
#include <string>
|
||||
namespace cocos2d {
|
||||
class CCCamera : public CCObject
|
||||
{
|
||||
CCCamera(void);
|
||||
|
||||
class CCCamera : public CCObject
|
||||
{
|
||||
void init(void);
|
||||
char * description(void);
|
||||
|
||||
CCCamera(void);
|
||||
|
||||
void init(void);
|
||||
char * description(void);
|
||||
|
||||
/** sets the dirty value */
|
||||
void setDirty(bool bValue);
|
||||
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 setDirty(bool bValue);
|
||||
bool getDirty(void);
|
||||
void restore(void);
|
||||
void locate(void);
|
||||
void setEyeXYZ(float fEyeX, float fEyeY, float fEyeZ);
|
||||
void setCenterXYZ(float fCenterX, float fCenterY, float fCenterZ);
|
||||
void setUpXYZ(float fUpX, float fUpY, float fUpZ);
|
||||
|
||||
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);
|
||||
/**
|
||||
@brief Pop out a message box
|
||||
*/
|
||||
void CCMessageBox(const char * pszMsg, const char * pszTitle);
|
||||
|
||||
}
|
||||
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 {
|
||||
/// sets a 2D projection (orthogonal projection)
|
||||
kCCDirectorProjection2D,
|
||||
class CCDirector : public CCObject
|
||||
{
|
||||
CCScene* getRunningScene(void);
|
||||
|
||||
/// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
|
||||
kCCDirectorProjection3D,
|
||||
double getAnimationInterval(void);
|
||||
|
||||
/// it calls "updateProjection" on the projection delegate.
|
||||
kCCDirectorProjectionCustom,
|
||||
bool isDisplayFPS(void);
|
||||
void setDisplayFPS(bool bDisplayFPS);
|
||||
|
||||
/// Detault projection is 3D projection
|
||||
kCCDirectorProjectionDefault = kCCDirectorProjection3D,
|
||||
bool isRetinaDisplay();
|
||||
bool isPaused(void);
|
||||
unsigned int getFrames(void);
|
||||
|
||||
// backward compatibility stuff
|
||||
CCDirectorProjection2D = kCCDirectorProjection2D,
|
||||
CCDirectorProjection3D = kCCDirectorProjection3D,
|
||||
CCDirectorProjectionCustom = kCCDirectorProjectionCustom,
|
||||
} ccDirectorProjection;
|
||||
CCSize getWinSize(void);
|
||||
CCSize getWinSizeInPixels(void);
|
||||
CCSize getDisplaySizeInPixels(void);
|
||||
|
||||
|
||||
typedef enum {
|
||||
kCCDirectorTypeNSTimer,
|
||||
kCCDirectorTypeMainLoop,
|
||||
kCCDirectorTypeThreadMainLoop,
|
||||
kCCDirectorTypeDisplayLink,
|
||||
kCCDirectorTypeDefault = kCCDirectorTypeNSTimer,
|
||||
CCDirectorTypeNSTimer = kCCDirectorTypeNSTimer,
|
||||
CCDirectorTypeMainLoop = kCCDirectorTypeMainLoop,
|
||||
CCDirectorTypeThreadMainLoop = kCCDirectorTypeThreadMainLoop,
|
||||
CCDirectorTypeDisplayLink = kCCDirectorTypeDisplayLink,
|
||||
CCDirectorTypeDefault =kCCDirectorTypeDefault,
|
||||
} ccDirectorType;
|
||||
CCPoint convertToGL(CCPoint obPoint);
|
||||
CCPoint convertToUI(CCPoint obPoint);
|
||||
|
||||
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,
|
||||
void runWithScene(CCScene *pScene);
|
||||
void pushScene(CCScene *pScene);
|
||||
void popScene(void);
|
||||
void replaceScene(CCScene *pScene);
|
||||
|
||||
// Backward compatibility stuff
|
||||
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
|
||||
CGFloat getContentScaleFactor(void);
|
||||
|
||||
int getDeviceOrientation();
|
||||
|
||||
static CCDirector* sharedDirector(void);
|
||||
};
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
|
||||
#include "CCGeometry.h" // for CCPoint
|
||||
namespace cocos2d {
|
||||
|
||||
/** draws a point given x and y coordinate measured in points */
|
||||
void ccDrawPoint( CCPoint point );
|
||||
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 ccDrawPoint(CCPoint point);
|
||||
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 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;
|
||||
|
||||
class CCPoint
|
||||
class CCPoint
|
||||
{
|
||||
public:
|
||||
float x;
|
||||
float y;
|
||||
public:
|
||||
CCPoint();
|
||||
CCPoint(float x, float y);
|
||||
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
||||
float x;
|
||||
float y;
|
||||
CCPoint();
|
||||
CCPoint(float x, float y);
|
||||
|
||||
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
||||
};
|
||||
|
||||
class CCSize
|
||||
class CCSize
|
||||
{
|
||||
public:
|
||||
float width;
|
||||
float height;
|
||||
float width;
|
||||
float height;
|
||||
CCSize();
|
||||
CCSize(float width, float height);
|
||||
|
||||
public:
|
||||
CCSize();
|
||||
CCSize(float width, float height);
|
||||
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
||||
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
||||
};
|
||||
|
||||
class CCRect
|
||||
{
|
||||
public:
|
||||
CCPoint origin;
|
||||
CCSize size;
|
||||
|
||||
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);
|
||||
CCPoint origin;
|
||||
CCSize size;
|
||||
CCRect();
|
||||
CCRect(float x, float y, float width, float height);
|
||||
|
||||
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 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);
|
||||
CCSize CCSizeMake(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, public CCLabelProtocol
|
||||
{
|
||||
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);
|
||||
class CCLabelAtlas : public CCAtlasNode
|
||||
{
|
||||
void updateAtlasValues();
|
||||
|
||||
/** 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 */
|
||||
bool initWithString(const char *label, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
|
||||
// super methods
|
||||
void updateAtlasValues();
|
||||
void setString(const char *label);
|
||||
const char* getString(void);
|
||||
void draw();
|
||||
void setString(const char *label);
|
||||
const char* getString(void);
|
||||
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D *texture);
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
};
|
||||
|
|
|
@ -1,65 +1,17 @@
|
|||
|
||||
#include "CCSpriteBatchNode.h"
|
||||
namespace cocos2d{
|
||||
class CCLabelBMFont : public CCNode
|
||||
{
|
||||
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 {
|
||||
|
||||
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
|
||||
|
||||
tolua_property__CCOpacity GLubyte opacity;
|
||||
|
||||
static void purgeCachedData();
|
||||
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
|
||||
};
|
||||
|
|
|
@ -1,29 +1,9 @@
|
|||
|
||||
#include "CCSprite.h"
|
||||
#include "CCTexture2D.h"
|
||||
|
||||
namespace cocos2d{
|
||||
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
|
||||
class CCLabelTTF : public CCSprite
|
||||
{
|
||||
void setString(const char *label);
|
||||
const char* getString(void);
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
CCLayer();
|
||||
bool init();
|
||||
static CCLayer *node(void);
|
||||
void onEnter();
|
||||
void onExit();
|
||||
void onEnterTransitionDidFinish();
|
||||
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
||||
void setIsAccelerometerEnabled(bool bValue);
|
||||
bool getIsAccelerometerEnabled();
|
||||
|
||||
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);
|
||||
bool getIsTouchEnabled();
|
||||
static CCLayer *node(void);
|
||||
};
|
||||
|
||||
void setIsAccelerometerEnabled(bool bValue);
|
||||
bool getIsAccelerometerEnabled();
|
||||
class CCLayerColor : public CCLayer
|
||||
{
|
||||
void changeWidth(GLfloat w);
|
||||
void changeHeight(GLfloat h);
|
||||
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
||||
|
||||
void setIsKeypadEnabled(bool bValue);
|
||||
bool getIsKeypadEnabled();
|
||||
|
||||
void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
||||
void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
||||
void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
||||
void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
||||
};
|
||||
void setOpacity(GLubyte var);
|
||||
GLubyte getOpacity(void);
|
||||
void setColor(ccColor3B Value);
|
||||
ccColor3B getColor(void);
|
||||
void setBlendFunc(ccBlendFunc Value);
|
||||
ccBlendFunc getBlendFunc(void);
|
||||
|
||||
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();
|
||||
void draw();
|
||||
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);
|
||||
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end);
|
||||
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end, CCPoint v);
|
||||
};
|
||||
|
||||
class CCLayerMultiplex : public CCLayer
|
||||
{
|
||||
void addLayer(CCLayer* layer);
|
||||
void switchTo(unsigned int n);
|
||||
void switchToAndReleaseMe(unsigned int n);
|
||||
|
||||
GLubyte getOpacity(void);
|
||||
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
|
||||
static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
|
||||
};
|
||||
|
|
|
@ -1,77 +1,24 @@
|
|||
|
||||
#include "CCMenuItem.h"
|
||||
#include "CCLayer.h"
|
||||
enum {
|
||||
//* 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
|
||||
{
|
||||
kCCMenuStateWaiting,
|
||||
kCCMenuStateTrackingTouch
|
||||
} tCCMenuState;
|
||||
void addChild(CCMenuItem* child, int zOrder = 0, int tag = -1);
|
||||
|
||||
enum {
|
||||
//* priority used by the menu
|
||||
kCCMenuTouchPriority = -128,
|
||||
};
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
}
|
||||
void setOpacity(GLubyte opacity);
|
||||
GLubyte getOpacity(void);
|
||||
void setColor(ccColor3B color);
|
||||
ccColor3B getColor(void);
|
||||
|
||||
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;
|
||||
class CCLabelAtlas;
|
||||
class CCSprite;
|
||||
tolua_property__CCIsEnabled bool isEnabled;
|
||||
|
||||
void registerScriptHandler(LUA_FUNCTION funcID);
|
||||
};
|
||||
|
||||
class CCMenuItem : public CCNode
|
||||
{
|
||||
class CCMenuItemLabel : public CCMenuItem
|
||||
{
|
||||
void setString(const char* label);
|
||||
|
||||
public:
|
||||
CCMenuItem();
|
||||
void setOpacity(GLubyte opacity);
|
||||
GLubyte getOpacity();
|
||||
void setColor(ccColor3B color);
|
||||
ccColor3B getColor();
|
||||
|
||||
static CCMenuItem * itemWithTarget(CCObject *rec, SEL_MenuHandler selector);
|
||||
bool initWithTarget(CCObject *rec, SEL_MenuHandler selector);
|
||||
static CCMenuItemLabel* itemWithLabel(CCNode* label);
|
||||
};
|
||||
|
||||
CCRect rect();
|
||||
void activate();
|
||||
void selected();
|
||||
void unselected();
|
||||
|
||||
void registerScriptHandler(const char* pszFunctionName);
|
||||
class CCMenuItemAtlasFont : public CCMenuItem
|
||||
{
|
||||
static CCMenuItemAtlasFont* itemFromString(const char* value,
|
||||
const char* charMapFile,
|
||||
int itemWidth,
|
||||
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:
|
||||
CCMenuItemLabel();
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite,
|
||||
CCNode* selectedSprite);
|
||||
static CCMenuItemSprite * itemFromNormalSprite(CCNode* normalSprite,
|
||||
CCNode* selectedSprite,
|
||||
CCNode* disabledSprite);
|
||||
};
|
||||
|
||||
static CCMenuItemLabel * itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector);
|
||||
static CCMenuItemLabel* itemWithLabel(CCNode *label);
|
||||
class CCMenuItemImage : public CCMenuItem
|
||||
{
|
||||
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);
|
||||
|
||||
virtual void activate();
|
||||
virtual void selected();
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
class CCMenuItemToggle : public CCMenuItem
|
||||
{
|
||||
void addSubItem(CCMenuItem *item);
|
||||
CCMenuItem* selectedItem();
|
||||
|
||||
static CCMenuItemToggle* itemWithItem(CCMenuItem *item);
|
||||
};
|
||||
|
|
|
@ -1,29 +1,11 @@
|
|||
|
||||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
class CCRibbon;
|
||||
class CCMotionStreak : public CCNode, public CCTextureProtocol
|
||||
class CCMotionStreak : public CCNode
|
||||
{
|
||||
|
||||
// CC_PROPERTY_READONLY(CCRibbon*, m_pRibbon, Ribbon)
|
||||
CCRibbon* getRibbon(void);
|
||||
|
||||
//CC_PROPERTY(CCTexture2D*, m_pTexture, Texture)
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D* var);
|
||||
|
||||
ccBlendFunc getBlendFunc(void);
|
||||
CCRibbon* getRibbon(void);
|
||||
void setTexture(CCTexture2D* var);
|
||||
CCTexture2D* getTexture(void);
|
||||
void setBlendFunc(ccBlendFunc var);
|
||||
ccBlendFunc getBlendFunc(void);
|
||||
|
||||
CCMotionStreak();
|
||||
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);
|
||||
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
|
||||
};
|
||||
|
||||
} // namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1,54 +1,38 @@
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
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);
|
||||
unsigned int getIndexOfObject(T pObject);
|
||||
T getLastObject(void);
|
||||
T getObjectAtIndex(unsigned int uIndex);
|
||||
|
||||
bool containsObject(T pObject);
|
||||
|
||||
T getLastObject(void);
|
||||
T getObjectAtIndex(unsigned int uIndex);
|
||||
|
||||
// Adding objects
|
||||
void addObject(T pObject);
|
||||
void addObjectsFromArray(CCMutableArray<T> *pArray);
|
||||
void addObject(T pObject);
|
||||
void addObjectsFromArray(CCMutableArray<T> *pArray);
|
||||
|
||||
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 removeAllObjects(bool bDeleteObject = true);
|
||||
void removeObjectAtIndex(unsigned int uIndex, 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>::reverse_iterator rend(void);
|
||||
CCMutableArray<T>* copy(void);
|
||||
|
||||
//static CCMutableArray<T>* arrayWithObjects(T pObject1, ...);
|
||||
|
||||
static CCMutableArray<T>* arrayWithArray(CCMutableArray<T> *pArray);
|
||||
std::vector<T>::iterator endToLua(void);
|
||||
std::vector<T>::reverse_iterator rend(void);
|
||||
CCMutableArray<T>* copy(void);
|
||||
|
||||
static CCMutableArray<T>* arrayWithArray(CCMutableArray<T> *pArray);
|
||||
};
|
||||
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1,35 +1,26 @@
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
class CCMutableDictionary : public CCObject
|
||||
{
|
||||
TOLUA_TEMPLATE_BIND(K V, std::string CCObject*)
|
||||
TOLUA_TEMPLATE_BIND(K V, std::string CCObject*)
|
||||
|
||||
CCMutableDictionary(void);
|
||||
~CCMutableDictionary(void);
|
||||
/// return the number of items
|
||||
unsigned int count();
|
||||
/// return all the keys
|
||||
std::vector<std::string> allKeys();
|
||||
unsigned int count();
|
||||
std::vector<std::string> allKeys();
|
||||
std::vector<std::string> allKeysForObject(V object);
|
||||
|
||||
/** @warning : We use '==' to compare two objects*/
|
||||
std::vector<std::string> allKeysForObject(V object);
|
||||
V objectForKey(K key);
|
||||
|
||||
V objectForKey(K key); ///<
|
||||
bool setObject(V pObject, K key);
|
||||
void removeObjectForKey(K key);
|
||||
bool begin();
|
||||
void endToLua();
|
||||
|
||||
bool setObject(V pObject, K key);
|
||||
void removeObjectForKey(K key);
|
||||
bool begin();
|
||||
V next(K* key = NULL);
|
||||
|
||||
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;
|
||||
}//namespace cocos2d
|
||||
|
||||
|
|
|
@ -1,106 +1,114 @@
|
|||
namespace cocos2d {
|
||||
enum {
|
||||
kCCNodeTagInvalid = -1,
|
||||
};
|
||||
|
||||
class CCNode : public CCObject
|
||||
{
|
||||
CCNode();
|
||||
int getZOrder();
|
||||
float getVertexZ();
|
||||
void setVertexZ(float var);
|
||||
float getRotation();
|
||||
void setRotation(float newRotation);
|
||||
float getScale();
|
||||
void setScale(float scale);
|
||||
float getScaleX();
|
||||
void setScaleX(float newScaleX);
|
||||
float getScaleY();
|
||||
void setScaleY(float newScaleY);
|
||||
CCPoint getPosition();
|
||||
void setPosition(CCPoint newPosition);
|
||||
|
||||
float getSkewX();
|
||||
void setSkewX(float skewX);
|
||||
float getSkewY();
|
||||
void setSkewY(float skewY);
|
||||
|
||||
CCMutableArray<CCNode*> * getChildren();
|
||||
CCCamera* getCamera();
|
||||
CCGridBase* getGrid();
|
||||
void setGrid(CCGridBase* pGrid);
|
||||
bool getIsVisible();
|
||||
void setIsVisible(bool var);
|
||||
CCPoint getAnchorPoint();
|
||||
void setAnchorPoint(CCPoint point);
|
||||
CCPoint getAnchorPointInPixels();
|
||||
CCSize getContentSizeInPixels();
|
||||
void setContentSizeInPixels(CCSize sz);
|
||||
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);
|
||||
int getZOrder();
|
||||
float getVertexZ();
|
||||
void setVertexZ(float var);
|
||||
float getRotation();
|
||||
void setRotation(float newRotation);
|
||||
float getScale();
|
||||
void setScale(float scale);
|
||||
float getScaleX();
|
||||
void setScaleX(float newScaleX);
|
||||
float getScaleY();
|
||||
void setScaleY(float newScaleY);
|
||||
CCPoint getPositionLua();
|
||||
void getPosition(float* x = 0, float* y = 0);
|
||||
float getPositionX();
|
||||
float getPositionY();
|
||||
void setPosition(CCPoint newPosition);
|
||||
void setPosition(float x, float y);
|
||||
void setPositionX(float x);
|
||||
void setPositionY(float y);
|
||||
float getSkewX();
|
||||
void setSkewX(float skewX);
|
||||
float getSkewY();
|
||||
void setSkewY(float skewY);
|
||||
bool getIsVisible();
|
||||
void setIsVisible(bool var);
|
||||
CCPoint getAnchorPoint();
|
||||
void setAnchorPoint(CCPoint point);
|
||||
CCSize getContentSize();
|
||||
void setContentSize(CCSize size);
|
||||
int getTag();
|
||||
void setTag(int var);
|
||||
|
||||
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 CCCopying
|
||||
class CCObject
|
||||
{
|
||||
|
||||
CCObject* copyWithZone(CCZone* pZone);
|
||||
void release(void);
|
||||
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();
|
||||
~CCParallaxNode();
|
||||
static CCParallaxNode * node();
|
||||
void addChild(CCNode * child, unsigned int z, CCPoint parallaxRatio, CCPoint positionOffset);
|
||||
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);
|
||||
class CCParallaxNode : public CCNode
|
||||
{
|
||||
struct _ccArray* getParallaxArray();
|
||||
void setParallaxArray(struct _ccArray * pval);
|
||||
|
||||
};
|
||||
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 {
|
||||
CCParticleSystem();
|
||||
static CCParticleSystem * particleWithFile(const char *plistFile);
|
||||
bool initWithFile(const char *plistFile);
|
||||
bool initWithDictionary(CCDictionary<std::string, CCObject*> *dictionary);
|
||||
bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
class CCParticleSystem : public CCNode
|
||||
{
|
||||
// mode A
|
||||
const CCPoint& getGravity();
|
||||
|
||||
// mode A
|
||||
const CCPoint& getGravity();
|
||||
void setGravity(const CCPoint& g);
|
||||
float getSpeed();
|
||||
void setSpeed(float speed);
|
||||
float getSpeedVar();
|
||||
void setSpeedVar(float speed);
|
||||
float getTangentialAccel();
|
||||
void setTangentialAccel(float t);
|
||||
float getTangentialAccelVar();
|
||||
void setTangentialAccelVar(float t);
|
||||
float getRadialAccel();
|
||||
void setRadialAccel(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);
|
||||
void setGravity(const CCPoint& g);
|
||||
float getSpeed();
|
||||
void setSpeed(float speed);
|
||||
float getSpeedVar();
|
||||
void setSpeedVar(float speed);
|
||||
float getTangentialAccel();
|
||||
void setTangentialAccel(float t);
|
||||
float getTangentialAccelVar();
|
||||
void setTangentialAccelVar(float t);
|
||||
float getRadialAccel();
|
||||
void setRadialAccel(float t);
|
||||
float getRadialAccelVar();
|
||||
void setRadialAccelVar(float t);
|
||||
|
||||
bool addParticle();
|
||||
void initParticle(tCCParticle* particle);
|
||||
void stopSystem();
|
||||
void resetSystem();
|
||||
bool isFull();
|
||||
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
||||
void postStep();
|
||||
void update(ccTime dt);
|
||||
// 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);
|
||||
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D* var);
|
||||
bool addParticle();
|
||||
void initParticle(tCCParticle* particle);
|
||||
void stopSystem();
|
||||
void resetSystem();
|
||||
bool isFull();
|
||||
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
||||
void postStep();
|
||||
|
||||
ccBlendFunc getBlendFunc(void);
|
||||
void setBlendFunc(ccBlendFunc var);
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D* var);
|
||||
|
||||
ccBlendFunc getBlendFunc(void);
|
||||
void setBlendFunc(ccBlendFunc var);
|
||||
|
||||
static CCParticleSystem * particleWithFile(const char *plistFile);
|
||||
};
|
||||
|
||||
class CCParticleSystemQuad : public CCParticleSystem {
|
||||
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
|
||||
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
|
||||
};
|
||||
|
||||
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 ccpAdd(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 ccpMidpoint(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 ccpRPerp(const CCPoint& v);
|
||||
|
||||
static CCPoint ccpProject(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 CGFloat ccpLengthSQ(const CCPoint& v);
|
||||
|
||||
CGFloat ccpLength(const CCPoint& v);
|
||||
|
||||
CGFloat ccpLength(const CCPoint& v);
|
||||
CGFloat ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
||||
|
||||
CCPoint ccpNormalize(const CCPoint& v);
|
||||
|
||||
CCPoint ccpForAngle(const CGFloat a);
|
||||
|
||||
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);
|
||||
|
||||
CCPoint ccpFromSize(const CCSize& s);
|
||||
|
||||
//CCPoint ccpCompOp(const CCPoint& p, float (*opFunc)(float));
|
||||
|
||||
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);
|
||||
CCPoint ccpFromSize(const CCSize& s);
|
||||
CCPoint ccpLerp(const CCPoint& a, const CCPoint& b, float alpha);
|
||||
|
||||
|
||||
bool ccpFuzzyEqual(const CCPoint& a, const CCPoint& b, float variance);
|
||||
|
||||
|
||||
CCPoint ccpCompMult(const CCPoint& a, const CCPoint& b);
|
||||
|
||||
float ccpAngleSigned(const CCPoint& a, const CCPoint& b);
|
||||
|
||||
float ccpAngle(const CCPoint& a, const CCPoint& b);
|
||||
|
||||
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 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);
|
||||
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,46 +1,29 @@
|
|||
namespace cocos2d
|
||||
{
|
||||
|
||||
typedef enum {
|
||||
/// Radial Counter-Clockwise
|
||||
kCCProgressTimerTypeRadialCCW,
|
||||
/// Radial ClockWise
|
||||
kCCProgressTimerTypeRadialCW,
|
||||
/// Horizontal Left-Right
|
||||
kCCProgressTimerTypeHorizontalBarLR,
|
||||
/// Horizontal Right-Left
|
||||
kCCProgressTimerTypeHorizontalBarRL,
|
||||
/// Vertical Bottom-top
|
||||
kCCProgressTimerTypeVerticalBarBT,
|
||||
/// Vertical Top-Bottom
|
||||
kCCProgressTimerTypeVerticalBarTB,
|
||||
typedef enum {
|
||||
/// Radial Counter-Clockwise
|
||||
kCCProgressTimerTypeRadialCCW,
|
||||
/// Radial ClockWise
|
||||
kCCProgressTimerTypeRadialCW,
|
||||
/// Horizontal Left-Right
|
||||
kCCProgressTimerTypeHorizontalBarLR,
|
||||
/// Horizontal Right-Left
|
||||
kCCProgressTimerTypeHorizontalBarRL,
|
||||
/// Vertical Bottom-top
|
||||
kCCProgressTimerTypeVerticalBarBT,
|
||||
/// Vertical Top-Bottom
|
||||
kCCProgressTimerTypeVerticalBarTB,
|
||||
} CCProgressTimerType;
|
||||
|
||||
|
||||
class CCProgressTimer : public CCNode
|
||||
class CCProgressTimer : public CCNode
|
||||
{
|
||||
CCProgressTimerType getType(void);
|
||||
float getPercentage(void);
|
||||
CCSprite* getSprite(void);
|
||||
|
||||
~CCProgressTimer(void);
|
||||
CCProgressTimerType getType(void);
|
||||
float getPercentage(void);
|
||||
|
||||
/** 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);
|
||||
|
||||
void setPercentage(float fPercentage);
|
||||
void setSprite(CCSprite *pSprite);
|
||||
void setType(CCProgressTimerType type);
|
||||
|
||||
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
|
||||
{
|
||||
kCCImageFormatJPG = 0,
|
||||
kCCImageFormatPNG = 1,
|
||||
kCCImageFormatJPG = 0,
|
||||
kCCImageFormatPNG = 1,
|
||||
kCCImageFormatRawData = 2
|
||||
} tImageFormat;
|
||||
|
||||
class CCRenderTexture : public CCNode
|
||||
class CCRenderTexture : public CCNode
|
||||
{
|
||||
/** The CCSprite being used.
|
||||
The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
|
||||
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);
|
||||
CCSprite* getSprite();
|
||||
void setSprite(CCSprite* psprite);
|
||||
|
||||
CCRenderTexture();
|
||||
~CCRenderTexture();
|
||||
/** 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 begin();
|
||||
void endToLua();
|
||||
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);
|
||||
bool saveBuffer(const char *name);
|
||||
bool saveBuffer(const char *name, int format);
|
||||
|
||||
/** saves the texture into a file */
|
||||
bool saveBuffer(const char *name);
|
||||
/** 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);
|
||||
|
||||
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
|
||||
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
|
||||
};
|
||||
|
||||
} // namespace cocos2d
|
||||
|
|
|
@ -1,46 +1,20 @@
|
|||
namespace cocos2d {
|
||||
|
||||
class CCRibbon: public CCNode
|
||||
{
|
||||
void setTexture(CCTexture2D* val);
|
||||
CCTexture2D* getTexture();
|
||||
|
||||
CCRibbon();
|
||||
~CCRibbon();
|
||||
void setTexture(CCTexture2D* val);
|
||||
CCTexture2D* getTexture();
|
||||
/** Texture lengths in pixels */
|
||||
float getTextureLength();
|
||||
void setTextureLength(float val);
|
||||
void setTextureLength(float val);
|
||||
float getTextureLength();
|
||||
|
||||
void setBlendFunc(ccBlendFunc val);
|
||||
ccBlendFunc getBlendFunc();
|
||||
void setBlendFunc(ccBlendFunc val);
|
||||
ccBlendFunc getBlendFunc();
|
||||
|
||||
void setColor(ccColor4B val);
|
||||
ccColor4B getColor();
|
||||
void setColor(ccColor4B val);
|
||||
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);
|
||||
|
||||
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();
|
||||
|
||||
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
|
||||
};
|
||||
|
||||
/** @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
|
||||
{
|
||||
void registerScriptEventsHandler(LUA_FUNCTION funcID);
|
||||
void unregisterScriptEventsHandler(void);
|
||||
|
||||
CCScene();
|
||||
virtual ~CCScene();
|
||||
bool init();
|
||||
static CCScene *node(void);
|
||||
|
||||
|
||||
static CCScene *node(void);
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1,75 +1,29 @@
|
|||
namespace cocos2d {
|
||||
|
||||
class CCTimer : public CCObject
|
||||
{
|
||||
|
||||
CCTimer(void);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
ccTime getInterval(void);
|
||||
void setInterval(ccTime fInterval);
|
||||
void update(ccTime dt);
|
||||
};
|
||||
|
||||
|
||||
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 scheduleScriptFunc(const char *pszFuncName, ccTime fInterval, bool bPaused);
|
||||
void unscheduleScriptFunc(const char *pszFuncName);
|
||||
void scheduleUpdateForTarget(CCObject *pTarget, int nPriority, bool bPaused);
|
||||
void scheduleUpdateForTarget(SelectorProtocol *pTarget, int nPriority, bool bPaused);
|
||||
void unscheduleUpdateForTarget(const SelectorProtocol *pTarget);
|
||||
|
||||
void unscheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget);
|
||||
|
||||
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 unscheduleAllSelectorsForTarget(SelectorProtocol *pTarget);
|
||||
void unscheduleAllSelectors(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 {
|
||||
//! Translate with it's parent
|
||||
CC_HONOR_PARENT_TRANSFORM_TRANSLATE = 1 << 0,
|
||||
|
@ -18,133 +14,55 @@ typedef enum {
|
|||
|
||||
} 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);
|
||||
bool isDirty(void);
|
||||
|
||||
/** get the quad (tex coords, vertex coords and color) information */
|
||||
ccV3F_C4B_T2F_Quad getQuad(void);
|
||||
|
||||
/** returns whether or not the texture rectangle is rotated */
|
||||
CCRect getTextureRect(void);
|
||||
bool isUsesBatchNode(void);
|
||||
bool isTextureRectRotated(void);
|
||||
|
||||
/** Set the index used on the TextureAtlas. */
|
||||
unsigned int getAtlasIndex(void);
|
||||
|
||||
void setAtlasIndex(unsigned int uAtlasIndex);
|
||||
|
||||
CCRect getTextureRect(void);
|
||||
|
||||
bool isUsesBatchNode(void);
|
||||
|
||||
unsigned int getAtlasIndex(void);
|
||||
void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode);
|
||||
|
||||
CCTextureAtlas* getTextureAtlas(void);
|
||||
void setTextureAtlas(CCTextureAtlas *pobTextureAtlas);
|
||||
|
||||
CCSpriteBatchNode* getSpriteBatchNode(void);
|
||||
CCTextureAtlas* getTextureAtlas(void);
|
||||
void setSpriteBatchNode(CCSpriteBatchNode *pobSpriteBatchNode);
|
||||
|
||||
ccHonorParentTransform getHonorParentTransform(void);
|
||||
CCSpriteBatchNode* getSpriteBatchNode(void);
|
||||
void setHonorParentTransform(ccHonorParentTransform eHonorParentTransform);
|
||||
ccHonorParentTransform getHonorParentTransform(void);
|
||||
void setBlendFunc(ccBlendFunc blendFunc);
|
||||
ccBlendFunc getBlendFunc(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 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 setIsVisible(bool bVisible);
|
||||
void setFlipX(bool bFlipX);
|
||||
void setFlipY(bool bFlipY);
|
||||
|
||||
bool isFlipX(void);
|
||||
|
||||
bool isFlipY(void);
|
||||
|
||||
void updateColor(void);
|
||||
|
||||
GLubyte getOpacity(void);
|
||||
|
||||
void setOpacity(GLubyte opacity);
|
||||
/** RGB colors: conforms to CCRGBAProtocol protocol */
|
||||
ccColor3B getColor(void);
|
||||
GLubyte getOpacity(void);
|
||||
|
||||
tolua_property__CCOpacity GLubyte opacity;
|
||||
|
||||
void setColor(ccColor3B color3);
|
||||
ccColor3B getColor(void);
|
||||
void setIsOpacityModifyRGB(bool bValue);
|
||||
bool getIsOpacityModifyRGB(void);
|
||||
|
||||
void setTexture(CCTexture2D *texture);
|
||||
void setTexture(CCTexture2D *texture);
|
||||
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 useSelfRender(void);
|
||||
|
||||
void setTextureRect(CCRect rect);
|
||||
|
||||
void setTextureRect(CCRect rect);
|
||||
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
|
||||
void useBatchNode(CCSpriteBatchNode *batchNode);
|
||||
void setDisplayFrame(CCSpriteFrame *pNewFrame);
|
||||
|
@ -152,6 +70,12 @@ class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
|||
CCSpriteFrame* displayedFrame(void);
|
||||
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
|
||||
{
|
||||
|
||||
~CCSpriteBatchNode();
|
||||
void increaseAtlasCapacity();
|
||||
void removeChildAtIndex(unsigned int index, bool doCleanup);
|
||||
void insertChild(CCSprite *child, unsigned int index);
|
||||
void removeSpriteFromAtlas(CCSprite *sprite);
|
||||
|
||||
|
||||
CCTextureAtlas* getTextureAtlas(void);
|
||||
void setTextureAtlas(CCTextureAtlas* textureAtlas);
|
||||
CCArray* getDescendants(void);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
void setTexture(CCTexture2D *texture);
|
||||
CCTexture2D* getTexture(void);
|
||||
void setBlendFunc(ccBlendFunc blendFunc);
|
||||
ccBlendFunc getBlendFunc(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);
|
||||
void setRectInPixels(CCRect rectInPixels);
|
||||
bool isRotated(void);
|
||||
void setRotated(bool bRotated);
|
||||
|
||||
bool isRotated(void);
|
||||
void setRotated(bool bRotated);
|
||||
CCRect getRect(void);
|
||||
void setRect(CCRect rect);
|
||||
|
||||
CCRect getRect(void);
|
||||
void setRect(CCRect rect);
|
||||
CCPoint getOffsetInPixels(void);
|
||||
void setOffsetInPixels(CCPoint offsetInPixels);
|
||||
|
||||
CCPoint getOffsetInPixels(void);
|
||||
void setOffsetInPixels(CCPoint offsetInPixels);
|
||||
CCSize getOriginalSizeInPixels(void);
|
||||
void setOriginalSizeInPixels(CCSize sizeInPixels);
|
||||
|
||||
CCSize getOriginalSizeInPixels(void);
|
||||
void setOriginalSizeInPixels(CCSize sizeInPixels);
|
||||
|
||||
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);
|
||||
CCTexture2D* getTexture(void);
|
||||
void setTexture(CCTexture2D* pobTexture);
|
||||
|
||||
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
|
||||
{
|
||||
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);
|
||||
~CCSpriteFrameCache(void);
|
||||
|
||||
void addSpriteFramesWithDictionary(CCDictionary<std::string, CCObject*> *pobDictionary, CCTexture2D *pobTexture);
|
||||
|
||||
void addSpriteFramesWithFile(const char *pszPlist);
|
||||
|
||||
|
||||
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);
|
||||
void removeSpriteFrames(void);
|
||||
void removeUnusedSpriteFrames(void);
|
||||
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);
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
CCString();
|
||||
CCString(const char * str);
|
||||
~CCString();
|
||||
int toInt();
|
||||
unsigned int toUInt();
|
||||
float toFloat();
|
||||
|
||||
bool isEmpty();
|
||||
};
|
||||
}// namespace cocos2d
|
||||
int toInt();
|
||||
unsigned int toUInt();
|
||||
float toFloat();
|
||||
bool isEmpty();
|
||||
};
|
||||
|
|
|
@ -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.
|
||||
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 releaseMap();
|
||||
class CCTMXLayer : public CCSpriteBatchNode
|
||||
{
|
||||
void setLayerSize(CCSize val);
|
||||
CCSize getLayerSize();
|
||||
|
||||
/** returns the tile (CCSprite) at a given a tile coordinate.
|
||||
The returned CCSprite will be already added to the CCTMXLayer. Don't add it again.
|
||||
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);
|
||||
void setMapTileSize(CCSize val);
|
||||
CCSize getMapTileSize();
|
||||
|
||||
/** returns the tile gid at a given tile coordinate.
|
||||
if it returns 0, it means that the tile is empty.
|
||||
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
|
||||
*/
|
||||
unsigned int tileGIDAt(CCPoint tileCoordinate);
|
||||
void setTiles(unsigned int* pval);
|
||||
unsigned int* getTiles();
|
||||
|
||||
/** sets the tile gid (gid = tile global id) at a given tile coordinate.
|
||||
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
|
||||
If a tile is already placed at that position, then it will be removed.
|
||||
*/
|
||||
void setTileGID(unsigned int gid, CCPoint tileCoordinate);
|
||||
void setTileSet(CCTMXTilesetInfo* pval);
|
||||
CCTMXTilesetInfo* getTileSet();
|
||||
|
||||
/** removes a tile at given tile coordinate */
|
||||
void removeTileAt(CCPoint tileCoordinate);
|
||||
void setLayerOrientation(unsigned int val);
|
||||
unsigned int getLayerOrientation();
|
||||
|
||||
/** returns the position in pixels of a given tile coordinate */
|
||||
CCPoint positionAt(CCPoint tileCoordinate);
|
||||
void setProperties(CCStringToStringDictionary* pval);
|
||||
CCStringToStringDictionary* getProperties();
|
||||
|
||||
/** return the value for the specific property name */
|
||||
CCString *propertyNamed(const char *propertyName);
|
||||
void releaseMap();
|
||||
|
||||
/** Creates the tiles */
|
||||
void setupTiles();
|
||||
|
||||
/** CCTMXLayer doesn't support adding a CCSprite manually.
|
||||
@warning addchild(z, tag); is not supported on CCTMXLayer. Instead of setTileGID.
|
||||
*/
|
||||
virtual void addChild(CCNode * child, int zOrder, int tag);
|
||||
// super method
|
||||
void removeChild(CCNode* child, bool cleanup);
|
||||
void draw();
|
||||
|
||||
const char* getLayerName();
|
||||
void setLayerName(const char *layerName);
|
||||
};
|
||||
|
||||
}// namespace cocos2d
|
||||
CCSprite* tileAt(CCPoint tileCoordinate);
|
||||
unsigned int tileGIDAt(CCPoint tileCoordinate);
|
||||
void setTileGID(unsigned int gid, CCPoint tileCoordinate);
|
||||
void removeTileAt(CCPoint tileCoordinate);
|
||||
CCPoint positionAt(CCPoint tileCoordinate);
|
||||
CCString *propertyNamed(const char *propertyName);
|
||||
void setupTiles();
|
||||
|
||||
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.
|
||||
@since v0.99.0
|
||||
*/
|
||||
class CCTMXObjectGroup : public CCObject
|
||||
{
|
||||
/** 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 */
|
||||
class CCTMXObjectGroup : public CCObject
|
||||
{
|
||||
void setPositionOffset(CCPoint pt);
|
||||
CCPoint getPositionOffset();
|
||||
|
||||
CCMutableArray<CCStringToStringDictionary*>* getObjects();
|
||||
void setObjects(CCMutableArray<CCStringToStringDictionary*>* val);
|
||||
void setProperties(CCStringToStringDictionary* pval);
|
||||
CCStringToStringDictionary* getProperties();
|
||||
|
||||
CCTMXObjectGroup();
|
||||
~CCTMXObjectGroup();
|
||||
void setObjects(CCMutableArray<CCStringToStringDictionary*>* val);
|
||||
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.
|
||||
It will return the 1st object found on the array for the given name.
|
||||
*/
|
||||
CCStringToStringDictionary *objectNamed(const char *objectName);
|
||||
|
||||
};
|
||||
|
||||
}// namespace cocos2d
|
||||
CCStringToStringDictionary* objectNamed(const char *objectName);
|
||||
};
|
||||
|
|
|
@ -1,60 +1,35 @@
|
|||
namespace cocos2d {
|
||||
enum
|
||||
{
|
||||
/** Orthogonal orientation */
|
||||
CCTMXOrientationOrtho,
|
||||
|
||||
/** Hexagonal orientation */
|
||||
CCTMXOrientationHex,
|
||||
enum
|
||||
{
|
||||
/** Orthogonal orientation */
|
||||
CCTMXOrientationOrtho,
|
||||
/** Hexagonal orientation */
|
||||
CCTMXOrientationHex,
|
||||
/** Isometric orientation */
|
||||
CCTMXOrientationIso,
|
||||
};
|
||||
|
||||
/** Isometric orientation */
|
||||
CCTMXOrientationIso,
|
||||
};
|
||||
class CCTMXTiledMap : public CCNode
|
||||
{
|
||||
void setMapSize(CCSize sz);
|
||||
CCSize getMapSize();
|
||||
|
||||
|
||||
class CCTMXTiledMap : public CCNode
|
||||
{
|
||||
/** 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 */
|
||||
void setTileSize(CCSize sz);
|
||||
CCSize getTileSize();
|
||||
|
||||
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
||||
void setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* pval);
|
||||
/** properties */
|
||||
CCStringToStringDictionary* getProperties();
|
||||
void setProperties(CCStringToStringDictionary* pval);
|
||||
void setMapOrientation(int val);
|
||||
int getMapOrientation();
|
||||
|
||||
CCTMXTiledMap();
|
||||
~CCTMXTiledMap();
|
||||
|
||||
/** 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 setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* pval);
|
||||
CCMutableArray<CCTMXObjectGroup*>* getObjectGroups();
|
||||
|
||||
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 {
|
||||
TMXLayerAttribNone = 1 << 0,
|
||||
TMXLayerAttribBase64 = 1 << 1,
|
||||
TMXLayerAttribGzip = 1 << 2,
|
||||
TMXLayerAttribZlib = 1 << 3,
|
||||
};
|
||||
enum {
|
||||
TMXLayerAttribNone = 1 << 0,
|
||||
TMXLayerAttribBase64 = 1 << 1,
|
||||
TMXLayerAttribGzip = 1 << 2,
|
||||
TMXLayerAttribZlib = 1 << 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
TMXPropertyNone,
|
||||
TMXPropertyMap,
|
||||
TMXPropertyLayer,
|
||||
TMXPropertyObjectGroup,
|
||||
TMXPropertyObject,
|
||||
TMXPropertyTile
|
||||
};
|
||||
enum {
|
||||
TMXPropertyNone,
|
||||
TMXPropertyMap,
|
||||
TMXPropertyLayer,
|
||||
TMXPropertyObjectGroup,
|
||||
TMXPropertyObject,
|
||||
TMXPropertyTile
|
||||
};
|
||||
|
||||
class CCTMXLayerInfo : public CCObject
|
||||
{
|
||||
CCStringToStringDictionary* getProperties();
|
||||
void setProperties(CCStringToStringDictionary* pval);
|
||||
|
||||
CCTMXLayerInfo();
|
||||
~CCTMXLayerInfo();
|
||||
};
|
||||
class CCTMXLayerInfo : public CCObject
|
||||
{
|
||||
CCStringToStringDictionary* getProperties();
|
||||
void setProperties(CCStringToStringDictionary* pval);
|
||||
};
|
||||
|
||||
|
||||
class CCTMXTilesetInfo : public CCObject
|
||||
{
|
||||
|
||||
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 CCTMXTilesetInfo : public CCObject
|
||||
{
|
||||
CCRect rectForGID(unsigned int gid);
|
||||
};
|
||||
|
||||
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 CCTextFieldDelegate
|
||||
class CCTextFieldTTF : public CCLabelTTF
|
||||
{
|
||||
|
||||
/**
|
||||
@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();
|
||||
|
||||
/**
|
||||
@brief End text input and close keyboard.
|
||||
*/
|
||||
bool detachWithIME();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// properties
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCTextFieldDelegate* getDelegate();
|
||||
void setDelegate(CCTextFieldDelegate *pVal);
|
||||
|
||||
|
||||
int getCharCount();
|
||||
void setColorSpaceHolder(ccColor3B val);
|
||||
ccColor3B getColorSpaceHolder();
|
||||
void setColorSpaceHolder(ccColor3B val);
|
||||
// input text property
|
||||
void setString(const char *text);
|
||||
const char* getString(void);
|
||||
void setString(const char *text);
|
||||
const char* getString(void);
|
||||
|
||||
void setPlaceHolder(const char * text);
|
||||
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 {
|
||||
kCCTexture2DPixelFormat_Automatic = 0,
|
||||
//! 32-bit texture: RGBA8888
|
||||
kCCTexture2DPixelFormat_RGBA8888,
|
||||
//! 24-bit texture: RGBA888
|
||||
kCCTexture2DPixelFormat_RGB888,
|
||||
//! 16-bit texture without Alpha channel
|
||||
kCCTexture2DPixelFormat_RGB565,
|
||||
//! 8-bit textures used as masks
|
||||
kCCTexture2DPixelFormat_A8,
|
||||
//! 8-bit intensity texture
|
||||
kCCTexture2DPixelFormat_I8,
|
||||
//! 16-bit textures used as masks
|
||||
kCCTexture2DPixelFormat_AI88,
|
||||
//! 16-bit textures: RGBA4444
|
||||
kCCTexture2DPixelFormat_RGBA4444,
|
||||
//! 16-bit textures: RGB5A1
|
||||
kCCTexture2DPixelFormat_RGB5A1,
|
||||
//! 4-bit PVRTC-compressed texture: PVRTC4
|
||||
kCCTexture2DPixelFormat_PVRTC4,
|
||||
//! 2-bit PVRTC-compressed texture: PVRTC2
|
||||
kCCTexture2DPixelFormat_PVRTC2,
|
||||
kCCTexture2DPixelFormat_Automatic = 0,
|
||||
//! 32-bit texture: RGBA8888
|
||||
kCCTexture2DPixelFormat_RGBA8888,
|
||||
//! 24-bit texture: RGBA888
|
||||
kCCTexture2DPixelFormat_RGB888,
|
||||
//! 16-bit texture without Alpha channel
|
||||
kCCTexture2DPixelFormat_RGB565,
|
||||
//! 8-bit textures used as masks
|
||||
kCCTexture2DPixelFormat_A8,
|
||||
//! 8-bit intensity texture
|
||||
kCCTexture2DPixelFormat_I8,
|
||||
//! 16-bit textures used as masks
|
||||
kCCTexture2DPixelFormat_AI88,
|
||||
//! 16-bit textures: RGBA4444
|
||||
kCCTexture2DPixelFormat_RGBA4444,
|
||||
//! 16-bit textures: RGB5A1
|
||||
kCCTexture2DPixelFormat_RGB5A1,
|
||||
//! 4-bit PVRTC-compressed texture: PVRTC4
|
||||
kCCTexture2DPixelFormat_PVRTC4,
|
||||
//! 2-bit PVRTC-compressed texture: PVRTC2
|
||||
kCCTexture2DPixelFormat_PVRTC2,
|
||||
|
||||
//! Default texture format: 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
|
||||
//! Default texture format: 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
|
||||
} CCTexture2DPixelFormat;
|
||||
|
||||
/**
|
||||
Extension to set the Min / Mag filter
|
||||
*/
|
||||
typedef struct _ccTexParams {
|
||||
GLuint minFilter;
|
||||
GLuint magFilter;
|
||||
GLuint wrapS;
|
||||
GLuint wrapT;
|
||||
} ccTexParams;
|
||||
|
||||
|
||||
class CCTexture2D : public CCObject
|
||||
{
|
||||
/** pixel format of the texture */
|
||||
CCTexture2DPixelFormat getPixelFormat();
|
||||
/** width in pixels */
|
||||
unsigned int getPixelsWide();
|
||||
unsigned int getPixelsHigh();
|
||||
CCTexture2DPixelFormat getPixelFormat();
|
||||
|
||||
/** texture name */
|
||||
GLuint getName();
|
||||
unsigned int getPixelsWide();
|
||||
unsigned int getPixelsHigh();
|
||||
|
||||
/** content size */
|
||||
CCSize getContentSizeInPixels();
|
||||
/** texture max S */
|
||||
void setMaxS(GLfloat val);
|
||||
GLfloat getMaxS();
|
||||
/** texture max T */
|
||||
GLfloat getMaxT();
|
||||
void setMaxT(GLfloat val);
|
||||
GLuint getName();
|
||||
|
||||
bool getHasPremultipliedAlpha();
|
||||
CCSize getContentSizeInPixels();
|
||||
|
||||
CCTexture2D();
|
||||
~CCTexture2D();
|
||||
void setMaxS(GLfloat val);
|
||||
GLfloat getMaxS();
|
||||
|
||||
char * description(void);
|
||||
GLfloat getMaxT();
|
||||
void setMaxT(GLfloat val);
|
||||
|
||||
/** These functions are needed to create mutable textures */
|
||||
void releaseData(void *data);
|
||||
void* keepData(void *data, unsigned int length);
|
||||
bool getHasPremultipliedAlpha();
|
||||
|
||||
/** Intializes with a texture2d with data */
|
||||
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize);
|
||||
void drawAtPoint(CCPoint point);
|
||||
void drawInRect(CCRect rect);
|
||||
|
||||
|
||||
/** draws a texture at a given point */
|
||||
void drawAtPoint(CCPoint point);
|
||||
/** draws a texture inside a rect */
|
||||
void drawInRect(CCRect rect);
|
||||
CCSize getContentSize(void);
|
||||
|
||||
/** Initializes a texture from a UIImage object */
|
||||
bool initWithImage(CCImage * uiImage);
|
||||
/** Initializes a texture from a string with dimensions, alignment, font name and font size */
|
||||
bool initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
||||
/** Initializes a texture from a string with font name and font size */
|
||||
bool initWithString(const char *text, const char *fontName, float fontSize);
|
||||
void setTexParameters(ccTexParams* texParams);
|
||||
void setAntiAliasTexParameters();
|
||||
void setAliasTexParameters();
|
||||
void generateMipmap();
|
||||
|
||||
/** returns the content size of the texture in points */
|
||||
CCSize getContentSize(void);
|
||||
|
||||
|
||||
void setTexParameters(ccTexParams* texParams);
|
||||
|
||||
void setAntiAliasTexParameters();
|
||||
|
||||
void setAliasTexParameters();
|
||||
|
||||
void generateMipmap();
|
||||
|
||||
int bitsPerPixelForFormat();
|
||||
|
||||
static void setDefaultAlphaPixelFormat(CCTexture2DPixelFormat format);
|
||||
static CCTexture2DPixelFormat defaultAlphaPixelFormat();
|
||||
int bitsPerPixelForFormat();
|
||||
|
||||
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 getCapacity();
|
||||
unsigned int getTotalQuads();
|
||||
unsigned int getCapacity();
|
||||
|
||||
CCTexture2D* getTexture();
|
||||
void setTexture(CCTexture2D* val);
|
||||
/** Quads that are going to be rendered */
|
||||
void setTexture(CCTexture2D* val);
|
||||
CCTexture2D* getTexture();
|
||||
|
||||
void setQuads(ccV3F_C4B_T2F_Quad* val);
|
||||
ccV3F_C4B_T2F_Quad* getQuads();
|
||||
void setQuads(ccV3F_C4B_T2F_Quad* val);
|
||||
ccV3F_C4B_T2F_Quad* getQuads();
|
||||
|
||||
CCTextureAtlas();
|
||||
~CCTextureAtlas();
|
||||
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);
|
||||
|
||||
char * description();
|
||||
|
||||
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();
|
||||
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
|
||||
{
|
||||
CCTexture2D* addImage(const char* fileimage);
|
||||
CCTexture2D* addUIImage(CCImage *image, const char *key);
|
||||
CCTexture2D* textureForKey(const char* key);
|
||||
|
||||
CCTextureCache();
|
||||
~CCTextureCache();
|
||||
void removeAllTextures();
|
||||
void removeUnusedTextures();
|
||||
void removeTexture(CCTexture2D* texture);
|
||||
void removeTextureForKey(const char *textureKeyName);
|
||||
void dumpCachedTextureInfo();
|
||||
|
||||
char * description(void);
|
||||
|
||||
/** 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 CCTextureCache * sharedTextureCache();
|
||||
static void reloadAllTextures();
|
||||
|
||||
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;
|
||||
static void purgeSharedTextureCache();
|
||||
};
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1,29 +1,15 @@
|
|||
|
||||
namespace cocos2d {
|
||||
typedef std::map<std::string, int> StringToIntegerDictionary;
|
||||
typedef std::pair<std::string, int> StringToIntegerPair;
|
||||
struct sImageTGA;
|
||||
class CCTileMapAtlas : public CCAtlasNode
|
||||
{
|
||||
typedef std::map<std::string, int> StringToIntegerDictionary;
|
||||
typedef std::pair<std::string, int> StringToIntegerPair;
|
||||
struct sImageTGA;
|
||||
|
||||
/** TileMap info */
|
||||
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
|
||||
class CCTileMapAtlas : public CCAtlasNode
|
||||
{
|
||||
struct sImageTGA* getTGAInfo();
|
||||
void setTGAInfo(struct sImageTGA* val);
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
CCTouch();
|
||||
CCTouch(int nViewId, float x, float y);
|
||||
|
||||
CCPoint locationInView(int nViewId);
|
||||
CCPoint previousLocationInView(int nViewId);
|
||||
int view() { return m_nViewId; }
|
||||
|
||||
void SetTouchInfo(int nViewId, float x, float y);
|
||||
int view();
|
||||
};
|
||||
|
||||
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 {
|
||||
/// An horizontal orientation where the Left is nearer
|
||||
kOrientationLeftOver = 0,
|
||||
/// An horizontal orientation where the Right is nearer
|
||||
kOrientationRightOver = 1,
|
||||
/// A vertical orientation where the Up is nearer
|
||||
kOrientationUpOver = 0,
|
||||
/// A vertical orientation where the Bottom is nearer
|
||||
kOrientationDownOver = 1,
|
||||
/// An horizontal orientation where the Left is nearer
|
||||
kOrientationLeftOver = 0,
|
||||
/// An horizontal orientation where the Right is nearer
|
||||
kOrientationRightOver = 1,
|
||||
/// A vertical orientation where the Up is nearer
|
||||
kOrientationUpOver = 0,
|
||||
/// A vertical orientation where the Bottom is nearer
|
||||
kOrientationDownOver = 1,
|
||||
} tOrientation;
|
||||
|
||||
/** @brief Base class for CCTransition scenes
|
||||
*/
|
||||
class CCTransitionScene : public CCScene
|
||||
class CCTransitionSceneOriented : public CCScene
|
||||
{
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
static CCTransitionSceneOriented* transitionWithDuration(ccTime t, CCScene* scene, tOrientation o);
|
||||
};
|
||||
|
||||
/** @brief A CCTransition that supports orientation like.
|
||||
* Possible orientation: LeftOver, RightOver, UpOver, DownOver
|
||||
*/
|
||||
class CCTransitionSceneOriented : public CCTransitionScene
|
||||
class CCTransitionRotoZoom : public CCScene
|
||||
{
|
||||
|
||||
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);
|
||||
static CCTransitionRotoZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionRotoZoom:
|
||||
Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
|
||||
*/
|
||||
class CCTransitionRotoZoom : public CCTransitionScene
|
||||
class CCTransitionJumpZoom : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionRotoZoom();
|
||||
~CCTransitionRotoZoom();
|
||||
void onEnter();
|
||||
static CCTransitionRotoZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionJumpZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionJumpZoom:
|
||||
Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
|
||||
*/
|
||||
class CCTransitionJumpZoom : public CCTransitionScene
|
||||
class CCTransitionMoveInL : public CCScene
|
||||
{
|
||||
CCTransitionJumpZoom();
|
||||
~CCTransitionJumpZoom();
|
||||
void onEnter();
|
||||
static CCTransitionJumpZoom* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionMoveInL* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionMoveInL:
|
||||
Move in from to the left the incoming scene.
|
||||
*/
|
||||
class CCTransitionMoveInL : public CCTransitionScene, public CCTransitionEaseScene
|
||||
class CCTransitionMoveInR : public CCScene
|
||||
{
|
||||
public:
|
||||
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);
|
||||
static CCTransitionMoveInR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionMoveInR:
|
||||
Move in from to the right the incoming scene.
|
||||
*/
|
||||
class CCTransitionMoveInR : public CCTransitionMoveInL
|
||||
class CCTransitionMoveInT : public CCScene
|
||||
{
|
||||
public:
|
||||
CCTransitionMoveInR();
|
||||
~CCTransitionMoveInR();
|
||||
void initScenes();
|
||||
static CCTransitionMoveInR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
static CCTransitionMoveInT* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionMoveInT:
|
||||
Move in from to the top the incoming scene.
|
||||
*/
|
||||
class CCTransitionMoveInT : public CCTransitionMoveInL
|
||||
class CCTransitionMoveInB : public CCScene
|
||||
{
|
||||
public:
|
||||
CCTransitionMoveInT();
|
||||
~CCTransitionMoveInT();
|
||||
void initScenes();
|
||||
static CCTransitionMoveInT* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
static CCTransitionMoveInB* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionMoveInB:
|
||||
Move in from to the bottom the incoming scene.
|
||||
*/
|
||||
class CCTransitionMoveInB : public CCTransitionMoveInL
|
||||
class CCTransitionSlideInL : public CCScene
|
||||
{
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
/** @brief CCTransitionSlideInR:
|
||||
Slide in the incoming scene from the right border.
|
||||
*/
|
||||
class CCTransitionSlideInR : public CCTransitionSlideInL
|
||||
class CCTransitionSlideInR : public CCScene
|
||||
{
|
||||
public:
|
||||
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);
|
||||
|
||||
|
||||
static CCTransitionSlideInR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionSlideInB:
|
||||
Slide in the incoming scene from the bottom border.
|
||||
*/
|
||||
class CCTransitionSlideInB : public CCTransitionSlideInL
|
||||
class CCTransitionSlideInB : public CCScene
|
||||
{
|
||||
|
||||
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);
|
||||
|
||||
|
||||
static CCTransitionSlideInB* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionSlideInT:
|
||||
Slide in the incoming scene from the top border.
|
||||
*/
|
||||
class CCTransitionSlideInT : public CCTransitionSlideInL
|
||||
class CCTransitionSlideInT : public CCScene
|
||||
{
|
||||
|
||||
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);
|
||||
|
||||
static CCTransitionSlideInT* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Shrink the outgoing scene while grow the incoming scene
|
||||
*/
|
||||
class CCTransitionShrinkGrow : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCTransitionShrinkGrow : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionShrinkGrow();
|
||||
~CCTransitionShrinkGrow();
|
||||
|
||||
void onEnter();
|
||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
||||
static CCTransitionShrinkGrow* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionShrinkGrow* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFlipX:
|
||||
Flips the screen horizontally.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionFlipX : public CCTransitionSceneOriented
|
||||
class CCTransitionFlipX : public CCScene
|
||||
{
|
||||
CCTransitionFlipX();
|
||||
~CCTransitionFlipX();
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFlipY:
|
||||
Flips the screen vertically.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionFlipY : public CCTransitionSceneOriented
|
||||
class CCTransitionFlipY : public CCScene
|
||||
{
|
||||
CCTransitionFlipY();
|
||||
~CCTransitionFlipY();
|
||||
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFlipAngular:
|
||||
Flips the screen half horizontally and half vertically.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionFlipAngular : public CCTransitionSceneOriented
|
||||
class CCTransitionFlipAngular : public CCScene
|
||||
{
|
||||
CCTransitionFlipAngular();
|
||||
~CCTransitionFlipAngular();
|
||||
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionZoomFlipX:
|
||||
Flips the screen horizontally doing a zoom out/in
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionZoomFlipX : public CCTransitionSceneOriented
|
||||
class CCTransitionZoomFlipX : public CCScene
|
||||
{
|
||||
CCTransitionZoomFlipX();
|
||||
~CCTransitionZoomFlipX();
|
||||
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionZoomFlipY:
|
||||
Flips the screen vertically doing a little zooming out/in
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionZoomFlipY : public CCTransitionSceneOriented
|
||||
class CCTransitionZoomFlipY : public CCScene
|
||||
{
|
||||
CCTransitionZoomFlipY();
|
||||
~CCTransitionZoomFlipY();
|
||||
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionZoomFlipAngular:
|
||||
Flips the screen half horizontally and half vertically doing a little zooming out/in.
|
||||
The front face is the outgoing scene and the back face is the incoming scene.
|
||||
*/
|
||||
class CCTransitionZoomFlipAngular : public CCTransitionSceneOriented
|
||||
class CCTransitionZoomFlipAngular : public CCScene
|
||||
{
|
||||
CCTransitionZoomFlipAngular();
|
||||
~CCTransitionZoomFlipAngular();
|
||||
|
||||
void onEnter();
|
||||
|
||||
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFade:
|
||||
Fade out the outgoing scene and then fade in the incoming scene.'''
|
||||
*/
|
||||
class CCTransitionFade : public CCTransitionScene
|
||||
class CCTransitionFade : public CCScene
|
||||
{
|
||||
CCTransitionFade();
|
||||
~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();
|
||||
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
|
||||
};
|
||||
|
||||
/**
|
||||
@brief CCTransitionCrossFade:
|
||||
Cross fades two scenes using the CCRenderTexture object.
|
||||
*/
|
||||
class CCTransitionCrossFade : public CCTransitionScene
|
||||
class CCTransitionCrossFade : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionCrossFade();
|
||||
~CCTransitionCrossFade();
|
||||
|
||||
void draw();
|
||||
void onEnter();
|
||||
void onExit();
|
||||
static CCTransitionCrossFade * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
|
||||
static CCTransitionCrossFade* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionTurnOffTiles:
|
||||
Turn off the tiles of the outgoing scene in random order
|
||||
*/
|
||||
class CCTransitionTurnOffTiles : public CCTransitionScene ,public CCTransitionEaseScene
|
||||
class CCTransitionTurnOffTiles : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionTurnOffTiles();
|
||||
~CCTransitionTurnOffTiles();
|
||||
|
||||
void onEnter();
|
||||
CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
static CCTransitionTurnOffTiles * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionTurnOffTiles* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionSplitCols:
|
||||
The odd columns goes upwards while the even columns goes downwards.
|
||||
*/
|
||||
class CCTransitionSplitCols : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCTransitionSplitCols : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionSplitCols();
|
||||
~CCTransitionSplitCols();
|
||||
|
||||
CCActionInterval* action(void);
|
||||
void onEnter();
|
||||
CCActionInterval * easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
static CCTransitionSplitCols * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
static CCTransitionSplitCols* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionSplitRows:
|
||||
The odd rows goes to the left while the even rows goes to the right.
|
||||
*/
|
||||
class CCTransitionSplitRows : public CCTransitionSplitCols
|
||||
class CCTransitionSplitRows : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionSplitRows();
|
||||
~CCTransitionSplitRows();
|
||||
|
||||
CCActionInterval* action(void);
|
||||
static CCTransitionSplitRows * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionSplitRows* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFadeTR:
|
||||
Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
|
||||
*/
|
||||
class CCTransitionFadeTR : public CCTransitionScene , public CCTransitionEaseScene
|
||||
class CCTransitionFadeTR : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionFadeTR();
|
||||
~CCTransitionFadeTR();
|
||||
CCActionInterval* actionWithSize(ccGridSize size);
|
||||
void onEnter();
|
||||
CCActionInterval* easeActionWithAction(CCActionInterval * action);
|
||||
|
||||
static CCTransitionFadeTR * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
|
||||
static CCTransitionFadeTR* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFadeBL:
|
||||
Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
|
||||
*/
|
||||
class CCTransitionFadeBL : public CCTransitionFadeTR
|
||||
class CCTransitionFadeBL : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionFadeBL();
|
||||
~CCTransitionFadeBL();
|
||||
CCActionInterval* actionWithSize(ccGridSize size);
|
||||
|
||||
static CCTransitionFadeBL * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
static CCTransitionFadeBL* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFadeUp:
|
||||
* Fade the tiles of the outgoing scene from the bottom to the top.
|
||||
*/
|
||||
class CCTransitionFadeUp : public CCTransitionFadeTR
|
||||
class CCTransitionFadeUp : public CCScene
|
||||
{
|
||||
|
||||
CCTransitionFadeUp();
|
||||
~CCTransitionFadeUp();
|
||||
CCActionInterval* actionWithSize(ccGridSize size);
|
||||
static CCTransitionFadeUp * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
|
||||
static CCTransitionFadeUp* transitionWithDuration(ccTime t, CCScene* scene);
|
||||
};
|
||||
|
||||
/** @brief CCTransitionFadeDown:
|
||||
* Fade the tiles of the outgoing scene from the top to the bottom.
|
||||
*/
|
||||
class CCTransitionFadeDown : public CCTransitionFadeTR
|
||||
class CCTransitionFadeDown : public CCScene
|
||||
{
|
||||
CCTransitionFadeDown();
|
||||
~CCTransitionFadeDown();
|
||||
CCActionInterval* actionWithSize(ccGridSize size);
|
||||
|
||||
static CCTransitionFadeDown * transitionWithDuration(ccTime t, CCScene* scene);
|
||||
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();
|
||||
|
||||
// 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);
|
||||
|
||||
// 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();
|
||||
// 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();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,111 +1,26 @@
|
|||
$using namespace cocos2d;
|
||||
|
||||
$pfile "CCNode.pkg"
|
||||
|
||||
$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"
|
||||
$#include "LuaCocos2d.h"
|
||||
|
||||
$pfile "CCAction.pkg"
|
||||
|
||||
$pfile "CCProtocols.pkg"
|
||||
|
||||
$pfile "CCSet.pkg"
|
||||
|
||||
$pfile "CCMutableArray.pkg"
|
||||
$pfile "CCMutableDictionary.pkg"
|
||||
|
||||
|
||||
$pfile "CCTouchDelegateProtocol.pkg"
|
||||
|
||||
|
||||
|
||||
$pfile "CCActionCamera.pkg"
|
||||
$pfile "CCActionEase.pkg"
|
||||
$pfile "CCActionGrid3D.pkg"
|
||||
$pfile "CCActionGrid.pkg"
|
||||
$pfile "CCActionInstant.pkg"
|
||||
$pfile "CCActionInterval.pkg"
|
||||
$pfile "CCActionGrid3D.pkg"
|
||||
$pfile "CCActionManager.pkg"
|
||||
$pfile "CCActionPageTurn3D.pkg"
|
||||
$pfile "CCActionProgressTimer.pkg"
|
||||
$pfile "CCActionTiledGrid.pkg"
|
||||
|
||||
$pfile "CCAffineTransform.pkg"
|
||||
$pfile "CCAnimation.pkg"
|
||||
$pfile "CCAnimationCache.pkg"
|
||||
$pfile "CCApplication.pkg"
|
||||
$pfile "CCArray.pkg"
|
||||
$pfile "CCAtlasNode.pkg"
|
||||
$pfile "CCAutoreleasePool.pkg"
|
||||
$pfile "CCCamera.pkg"
|
||||
$pfile "ccConfig.pkg"
|
||||
$pfile "CCCommon.pkg"
|
||||
$pfile "CCDirector.pkg"
|
||||
$pfile "CCDrawingPrimitives.pkg"
|
||||
$pfile "CCEGLView.pkg"
|
||||
$pfile "CCFileUtils.pkg"
|
||||
$pfile "CCGeometry.pkg"
|
||||
$pfile "CCGL.pkg"
|
||||
$pfile "CCIMEDelegate.pkg"
|
||||
$pfile "CCIMEDispatcher.pkg"
|
||||
$pfile "CCKeypadDelegate.pkg"
|
||||
$pfile "CCKeypadDispatcher.pkg"
|
||||
$pfile "CCLabelAtlas.pkg"
|
||||
$pfile "CCLabelBMFont.pkg"
|
||||
$pfile "CCLabelTTF.pkg"
|
||||
|
@ -113,7 +28,35 @@ $pfile "CCLayer.pkg"
|
|||
$pfile "CCMenu.pkg"
|
||||
$pfile "CCMenuItem.pkg"
|
||||
$pfile "CCMotionStreak.pkg"
|
||||
|
||||
$pfile "CCCommon.pkg"
|
||||
|
||||
$pfile "CCMutableArray.pkg"
|
||||
$pfile "CCMutableDictionary.pkg"
|
||||
$pfile "CCNode.pkg"
|
||||
$pfile "CCObject.pkg"
|
||||
$pfile "CCParallaxNode.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.
|
||||
****************************************************************************/
|
||||
|
||||
namespace CocosDenshion {
|
||||
|
||||
/**
|
||||
@class SimpleAudioEngine
|
||||
@brief offer a VERY simple interface to play background music & sound effect
|
||||
*/
|
||||
class SimpleAudioEngine
|
||||
{
|
||||
SimpleAudioEngine();
|
||||
~SimpleAudioEngine();
|
||||
|
||||
/**
|
||||
@brief Get the shared Engine object,it will new one when first time be called
|
||||
*/
|
||||
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
|
||||
@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
|
||||
*/
|
||||
void preloadBackgroundMusic(const char* pszFilePath);
|
||||
|
||||
|
||||
/**
|
||||
@brief Play background music
|
||||
@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);
|
||||
|
||||
// for sound effects
|
||||
/**
|
||||
@brief Play sound effect
|
||||
@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
|
||||
*/
|
||||
// for sound effects
|
||||
/**
|
||||
@brief Play sound effect
|
||||
@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
|
||||
*/
|
||||
unsigned int playEffect(const char* pszFilePath, bool bLoop = false);
|
||||
|
||||
/**
|
||||
|
@ -132,7 +117,7 @@ class SimpleAudioEngine
|
|||
|
||||
/**
|
||||
@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
|
||||
*/
|
||||
void preloadEffect(const char* pszFilePath);
|
||||
|
@ -143,5 +128,3 @@ class SimpleAudioEngine
|
|||
*/
|
||||
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=".">
|
||||
<description>
|
||||
Utilises tolua++ to create the lua bindings to expose cocos2d-x functionality to lua
|
||||
|
@ -7,58 +8,65 @@
|
|||
<target name="cocos2d-x-bindings">
|
||||
<echo message="Calling tolua++" />
|
||||
<exec executable="${tolua++}">
|
||||
<arg value="-tCocos2d"/>
|
||||
<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[CCMutableArray<cocos2d::]]></replacetoken>
|
||||
<replacevalue><![CDATA[cocos2d::CCMutableArray<]]></replacevalue>
|
||||
<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>
|
||||
<!-- I think this next patch is un-neccessary -->
|
||||
|
||||
<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[cocos2d::ccColor3B color = *((cocos2d::ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&(const cocos2d::ccColor3B)ccBLACK));]]></replacetoken>
|
||||
<replacevalue><![CDATA[const cocos2d::ccColor3B clr = ccBLACK;
|
||||
cocos2d::ccColor3B color = *((cocos2d::ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&clr));]]></replacevalue>
|
||||
<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[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>
|
||||
<replacevalue><![CDATA[using namespace cocos2d;
|
||||
<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);
|
||||
|
||||
/* function to release collected object via destructor */]]></replacevalue>
|
||||
</replace>
|
||||
<replace file="LuaCocos2d.cpp">
|
||||
<replacetoken><![CDATA[*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include "stdlib.h"
|
||||
#endif]]></replacetoken>
|
||||
<replacevalue><![CDATA[*/
|
||||
|
||||
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"
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include "stdlib.h"
|
||||
#endif]]></replacevalue>
|
||||
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>
|
||||
|
|
|
@ -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 int GLint;
|
||||
typedef int GLsizei;
|
||||
|
@ -5,54 +8,44 @@ typedef unsigned char GLubyte;
|
|||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
namespace cocos2d {
|
||||
|
||||
/** RGB color composed of bytes 3 bytes
|
||||
@since v0.8
|
||||
*/
|
||||
|
||||
|
||||
typedef float ccTime;
|
||||
typedef struct _ccColor3B
|
||||
{
|
||||
GLubyte r;
|
||||
GLubyte g;
|
||||
GLubyte b;
|
||||
GLubyte r;
|
||||
GLubyte g;
|
||||
GLubyte b;
|
||||
} ccColor3B;
|
||||
|
||||
//! helper macro that creates an ccColor3B type
|
||||
static ccColor3B ccc3(const GLubyte r, const GLubyte g, const GLubyte b);
|
||||
/*
|
||||
//ccColor3B predefined colors
|
||||
//! White color (255,255,255)
|
||||
const ccColor3B ccWHITE;
|
||||
static ccColor3B ccc3(const GLubyte r, const GLubyte g, const GLubyte b);
|
||||
|
||||
// static const ccColor3B ccWHITE;
|
||||
//! Yellow color (255,255,0)
|
||||
const ccColor3B ccYELLOW;
|
||||
// static const ccColor3B ccYELLOW;
|
||||
//! Blue color (0,0,255)
|
||||
const ccColor3B ccBLUE;
|
||||
// static const ccColor3B ccBLUE;
|
||||
//! Green Color (0,255,0)
|
||||
const ccColor3B ccGREEN;
|
||||
// static const ccColor3B ccGREEN;
|
||||
//! Red Color (255,0,0,)
|
||||
const ccColor3B ccRED;
|
||||
// static const ccColor3B ccRED;
|
||||
//! Magenta Color (255,0,255)
|
||||
const ccColor3B ccMAGENTA;
|
||||
// static const ccColor3B ccMAGENTA;
|
||||
//! Black Color (0,0,0)
|
||||
const ccColor3B ccBLACK;
|
||||
// static const ccColor3B ccBLACK;
|
||||
//! Orange Color (255,127,0)
|
||||
const ccColor3B ccORANGE;
|
||||
// static const ccColor3B ccORANGE;
|
||||
//! Gray Color (166,166,166)
|
||||
const ccColor3B ccGRAY;
|
||||
*/
|
||||
// static const ccColor3B ccGRAY;
|
||||
|
||||
/** RGBA color composed of 4 bytes
|
||||
@since v0.8
|
||||
*/
|
||||
typedef struct _ccColor4B
|
||||
{
|
||||
GLubyte r;
|
||||
GLubyte g;
|
||||
GLubyte b;
|
||||
GLubyte a;
|
||||
GLubyte r;
|
||||
GLubyte g;
|
||||
GLubyte b;
|
||||
GLubyte a;
|
||||
} ccColor4B;
|
||||
//! helper macro that creates an ccColor4B type
|
||||
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
|
||||
*/
|
||||
typedef struct _ccColor4F {
|
||||
GLfloat r;
|
||||
GLfloat g;
|
||||
GLfloat b;
|
||||
GLfloat a;
|
||||
GLfloat r;
|
||||
GLfloat g;
|
||||
GLfloat b;
|
||||
GLfloat a;
|
||||
} ccColor4F;
|
||||
|
||||
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
|
||||
|
@ -87,8 +80,8 @@ static bool ccc4FEqual(ccColor4F a, ccColor4F b);
|
|||
*/
|
||||
typedef struct _ccVertex2F
|
||||
{
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
} ccVertex2F;
|
||||
|
||||
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
|
||||
{
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
} ccVertex3F;
|
||||
|
||||
static ccVertex3F vertex3(const float x, const float y, const float z);
|
||||
|
||||
|
||||
/** A texcoord composed of 2 floats: u, y
|
||||
@since v0.8
|
||||
*/
|
||||
typedef struct _ccTex2F {
|
||||
GLfloat u;
|
||||
GLfloat v;
|
||||
GLfloat u;
|
||||
GLfloat v;
|
||||
} ccTex2F;
|
||||
|
||||
static ccTex2F tex2(const float u, const float v);
|
||||
|
||||
|
||||
|
||||
|
||||
//! Point Sprite component
|
||||
typedef struct _ccPointSprite
|
||||
{
|
||||
ccVertex2F pos; // 8 bytes
|
||||
ccColor4B color; // 4 bytes
|
||||
GLfloat size; // 4 bytes
|
||||
ccVertex2F pos; // 8 bytes
|
||||
ccColor4B color; // 4 bytes
|
||||
GLfloat size; // 4 bytes
|
||||
} ccPointSprite;
|
||||
|
||||
//! A 2D Quad. 4 * 2 floats
|
||||
typedef struct _ccQuad2 {
|
||||
ccVertex2F tl;
|
||||
ccVertex2F tr;
|
||||
ccVertex2F bl;
|
||||
ccVertex2F br;
|
||||
ccVertex2F tl;
|
||||
ccVertex2F tr;
|
||||
ccVertex2F bl;
|
||||
ccVertex2F br;
|
||||
} ccQuad2;
|
||||
|
||||
|
||||
//! A 3D Quad. 4 * 3 floats
|
||||
typedef struct _ccQuad3 {
|
||||
ccVertex3F bl;
|
||||
ccVertex3F br;
|
||||
ccVertex3F tl;
|
||||
ccVertex3F tr;
|
||||
ccVertex3F bl;
|
||||
ccVertex3F br;
|
||||
ccVertex3F tl;
|
||||
ccVertex3F tr;
|
||||
} ccQuad3;
|
||||
|
||||
//! A 2D grid size
|
||||
typedef struct _ccGridSize
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int x;
|
||||
int y;
|
||||
} 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
|
||||
typedef struct _ccV2F_C4B_T2F
|
||||
{
|
||||
//! vertices (2F)
|
||||
ccVertex2F vertices;
|
||||
//! colors (4B)
|
||||
ccColor4B colors;
|
||||
//! tex coords (2F)
|
||||
ccTex2F texCoords;
|
||||
//! vertices (2F)
|
||||
ccVertex2F vertices;
|
||||
//! colors (4B)
|
||||
ccColor4B colors;
|
||||
//! tex coords (2F)
|
||||
ccTex2F texCoords;
|
||||
} ccV2F_C4B_T2F;
|
||||
|
||||
//! a Point with a vertex point, a tex coord point and a color 4F
|
||||
typedef struct _ccV2F_C4F_T2F
|
||||
{
|
||||
//! vertices (2F)
|
||||
ccVertex2F vertices;
|
||||
//! colors (4F)
|
||||
ccColor4F colors;
|
||||
//! tex coords (2F)
|
||||
ccTex2F texCoords;
|
||||
//! vertices (2F)
|
||||
ccVertex2F vertices;
|
||||
//! colors (4F)
|
||||
ccColor4F colors;
|
||||
//! tex coords (2F)
|
||||
ccTex2F texCoords;
|
||||
} ccV2F_C4F_T2F;
|
||||
|
||||
//! a Point with a vertex point, a tex coord point and a color 4B
|
||||
typedef struct _ccV3F_C4B_T2F
|
||||
{
|
||||
//! vertices (3F)
|
||||
ccVertex3F vertices; // 12 bytes
|
||||
//! vertices (3F)
|
||||
ccVertex3F vertices; // 12 bytes
|
||||
// char __padding__[4];
|
||||
|
||||
//! colors (4B)
|
||||
ccColor4B colors; // 4 bytes
|
||||
//! colors (4B)
|
||||
ccColor4B colors; // 4 bytes
|
||||
// char __padding2__[4];
|
||||
|
||||
// tex coords (2F)
|
||||
ccTex2F texCoords; // 8 byts
|
||||
// tex coords (2F)
|
||||
ccTex2F texCoords; // 8 byts
|
||||
} ccV3F_C4B_T2F;
|
||||
|
||||
//! 4 ccVertex2FTex2FColor4B Quad
|
||||
typedef struct _ccV2F_C4B_T2F_Quad
|
||||
{
|
||||
//! bottom left
|
||||
ccV2F_C4B_T2F bl;
|
||||
//! bottom right
|
||||
ccV2F_C4B_T2F br;
|
||||
//! top left
|
||||
ccV2F_C4B_T2F tl;
|
||||
//! top right
|
||||
ccV2F_C4B_T2F tr;
|
||||
//! bottom left
|
||||
ccV2F_C4B_T2F bl;
|
||||
//! bottom right
|
||||
ccV2F_C4B_T2F br;
|
||||
//! top left
|
||||
ccV2F_C4B_T2F tl;
|
||||
//! top right
|
||||
ccV2F_C4B_T2F tr;
|
||||
} ccV2F_C4B_T2F_Quad;
|
||||
|
||||
//! 4 ccVertex3FTex2FColor4B
|
||||
typedef struct _ccV3F_C4B_T2F_Quad
|
||||
{
|
||||
//! top left
|
||||
ccV3F_C4B_T2F tl;
|
||||
//! bottom left
|
||||
ccV3F_C4B_T2F bl;
|
||||
//! top right
|
||||
ccV3F_C4B_T2F tr;
|
||||
//! bottom right
|
||||
ccV3F_C4B_T2F br;
|
||||
//! top left
|
||||
ccV3F_C4B_T2F tl;
|
||||
//! bottom left
|
||||
ccV3F_C4B_T2F bl;
|
||||
//! top right
|
||||
ccV3F_C4B_T2F tr;
|
||||
//! bottom right
|
||||
ccV3F_C4B_T2F br;
|
||||
} ccV3F_C4B_T2F_Quad;
|
||||
|
||||
//! 4 ccVertex2FTex2FColor4F Quad
|
||||
typedef struct _ccV2F_C4F_T2F_Quad
|
||||
{
|
||||
//! bottom left
|
||||
ccV2F_C4F_T2F bl;
|
||||
//! bottom right
|
||||
ccV2F_C4F_T2F br;
|
||||
//! top left
|
||||
ccV2F_C4F_T2F tl;
|
||||
//! top right
|
||||
ccV2F_C4F_T2F tr;
|
||||
//! bottom left
|
||||
ccV2F_C4F_T2F bl;
|
||||
//! bottom right
|
||||
ccV2F_C4F_T2F br;
|
||||
//! top left
|
||||
ccV2F_C4F_T2F tl;
|
||||
//! top right
|
||||
ccV2F_C4F_T2F tr;
|
||||
} ccV2F_C4F_T2F_Quad;
|
||||
|
||||
//! Blend Function used for textures
|
||||
typedef struct _ccBlendFunc
|
||||
{
|
||||
//! source blend function
|
||||
GLenum src;
|
||||
//! destination blend function
|
||||
GLenum dst;
|
||||
//! source blend function
|
||||
GLenum src;
|
||||
//! destination blend function
|
||||
GLenum dst;
|
||||
} ccBlendFunc;
|
||||
|
||||
//! delta time type
|
||||
|
@ -243,13 +236,9 @@ typedef struct _ccBlendFunc
|
|||
|
||||
//typedef double ccTime;
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
CCTextAlignmentLeft,
|
||||
CCTextAlignmentCenter,
|
||||
CCTextAlignmentRight,
|
||||
CCTextAlignmentLeft,
|
||||
CCTextAlignmentCenter,
|
||||
CCTextAlignmentRight,
|
||||
} CCTextAlignment;
|
||||
|
||||
}//namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
d2ec87961c13d8ae29e5d9bd84aec0a4465c668c
|
Loading…
Reference in New Issue