2011-09-19 00:56:23 +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 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 ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
2011-06-14 14:31:25 +08:00
|
|
|
GLubyte getOpacity(void);
|
2011-09-19 00:56:23 +08:00
|
|
|
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);
|
|
|
|
|
|
|
|
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
|