2011-06-14 14:31:25 +08:00
|
|
|
#include "CCNode.h"
|
|
|
|
#include "CCProtocols.h"
|
|
|
|
#include "CCTouchDelegateProtocol.h"
|
|
|
|
#include "CCAccelerometerDelegate.h"
|
|
|
|
#include "CCKeypadDelegate.h"
|
|
|
|
|
|
|
|
namespace cocos2d {
|
|
|
|
|
|
|
|
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 destroy(void);
|
|
|
|
void keep(void);
|
|
|
|
|
|
|
|
void didAccelerate(CCAcceleration* pAccelerationValue) {}
|
|
|
|
void AccelerometerDestroy(void);
|
|
|
|
void AccelerometerKeep(void);
|
|
|
|
|
|
|
|
void KeypadDestroy();
|
|
|
|
void KeypadKeep();
|
|
|
|
void registerWithTouchDispatcher(void);
|
|
|
|
|
|
|
|
void setIsTouchEnabled(bool bValue);
|
|
|
|
bool getIsTouchEnabled();
|
|
|
|
|
|
|
|
void setIsAccelerometerEnabled(bool bValue);
|
|
|
|
bool getIsAccelerometerEnabled();
|
|
|
|
|
|
|
|
void setIsKeypadEnabled(bool bValue);
|
|
|
|
bool getIsKeypadEnabled();
|
2011-06-20 17:31:38 +08:00
|
|
|
|
|
|
|
void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
2011-06-14 14:31:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
GLubyte getOpacity(void);
|
|
|
|
void setOpacity(GLubyte var);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setColor(ccColor3B Value);
|
|
|
|
ccColor3B getColor(void);
|
|
|
|
|
|
|
|
void setBlendFunc(ccBlendFunc Value);
|
|
|
|
ccBlendFunc getBlendFunc(void);
|
|
|
|
|
|
|
|
CCRGBAProtocol* convertToRGBAProtocol();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
2011-07-08 22:32:54 +08:00
|
|
|
|
|
|
|
void setIsCompressedInterpolation(bool Value);
|
|
|
|
bool getIsCompressedInterpolation(void);
|
|
|
|
|
2011-06-14 14:31:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-08 22:32:54 +08:00
|
|
|
class CCLayerMultiplex : public CCLayer
|
2011-06-14 14:31:25 +08:00
|
|
|
{
|
2011-07-08 22:32:54 +08:00
|
|
|
CCLayerMultiplex();
|
|
|
|
//static CCLayerMultiplex * layerWithLayers(CCLayer* layer, ... );
|
2011-06-14 14:31:25 +08:00
|
|
|
//lua instead with follow func
|
2011-07-08 22:32:54 +08:00
|
|
|
static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
|
2011-06-14 14:31:25 +08:00
|
|
|
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
|