axmol/tools/tolua++/CCSprite.pkg

159 lines
4.7 KiB
Plaintext
Raw Normal View History

2011-06-14 14:31:25 +08:00
namespace cocos2d {
2011-07-11 14:00:55 +08:00
#define CCSpriteIndexNotInitialized 0xffffffff
2011-06-14 14:31:25 +08:00
typedef enum {
//! Translate with it's parent
CC_HONOR_PARENT_TRANSFORM_TRANSLATE = 1 << 0,
//! Rotate with it's parent
CC_HONOR_PARENT_TRANSFORM_ROTATE = 1 << 1,
//! Scale with it's parent
CC_HONOR_PARENT_TRANSFORM_SCALE = 1 << 2,
2011-07-11 14:00:55 +08:00
//! Skew with it's parent
CC_HONOR_PARENT_TRANSFORM_SKEW = 1 << 3,
2011-06-14 14:31:25 +08:00
//! All possible transformation enabled. Default value.
2011-07-11 14:00:55 +08:00
CC_HONOR_PARENT_TRANSFORM_ALL = CC_HONOR_PARENT_TRANSFORM_TRANSLATE | CC_HONOR_PARENT_TRANSFORM_ROTATE | CC_HONOR_PARENT_TRANSFORM_SCALE | CC_HONOR_PARENT_TRANSFORM_SKEW,
2011-06-14 14:31:25 +08:00
} ccHonorParentTransform;
class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
{
void draw(void);
bool isDirty(void);
/** make the Sprite to be updated in the Atlas. */
void setDirty(bool bDirty);
/** 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 */
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);
void setUsesSpriteBatchNode(bool bUsesSpriteBatchNode);
CCTextureAtlas* getTextureAtlas(void);
void setTextureAtlas(CCTextureAtlas *pobTextureAtlas);
CCSpriteBatchNode* getSpriteBatchNode(void);
void setSpriteBatchNode(CCSpriteBatchNode *pobSpriteBatchNode);
ccHonorParentTransform getHornorParentTransform(void);
void setHornorParentTransform(ccHonorParentTransform eHonorParentTransform);
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);
2011-07-11 14:00:55 +08:00
void setSkewX(float sx);
void setSkewY(float sy);
2011-06-14 14:31:25 +08:00
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);
void setColor(ccColor3B color3);
void setIsOpacityModifyRGB(bool bValue);
bool getIsOpacityModifyRGB(void);
CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol *)this; }
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);
2011-08-02 16:21:23 +08:00
void setTextureRect(CCRect rect);
2011-06-14 14:31:25 +08:00
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
void useBatchNode(CCSpriteBatchNode *batchNode);
void setDisplayFrame(CCSpriteFrame *pNewFrame);
bool isFrameDisplayed(CCSpriteFrame *pFrame);
CCSpriteFrame* displayedFrame(void);
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
};
}//namespace cocos2d