当前位置:编程学习 > wap >>

cocos2d-x 动画详解之一CCSprite

struct transformValues_ 拥有如下几个参数

CCPoint pos; // position x and y 位置
CCPoint scale; // scale x and y 放大缩小
float rotation; 旋转
CCPoint skew; // skew x and y 倾斜
CCPoint ap; // anchor point in pixels 锚点
bool visible; 是否可见

Public Member Functions
virtual GLubyte getOpacity (void)
  getOpacity 获取透明度
virtual void setOpacity (GLubyte var)
  setOpacity 设置透明度
virtual const ccColor3B & getColor (void)
  getColor 获取颜色
virtual void setColor (const ccColor3B &var)
  setColor 设置颜色
virtual void draw (void) 绘制 可以覆盖转换为自己的绘制方式
  Override this method to draw your own node.
bool isDirty (void) 精灵是否需要更新在自己所在在的位图上
  whether or not the Sprite needs to be updated in the Atlas
void setDirty (bool bDirty) 设置是否需要更新
  make the Sprite to be updated in the Atlas.
ccV3F_C4B_T2F_Quad getQuad (void) 获取文本位置 顶点位置 和颜色
  get the quad (tex coords, vertex coords and color) information
bool isTextureRectRotated (void) 是否旋转
  returns whether or not the texture rectangle is rotated
unsigned int getAtlasIndex (void) 获取所在图片集ID
  Set the index used on the TextureAtlas.
void setAtlasIndex (unsigned int uAtlasIndex) 设置说属图片集ID
  Set the index used on the TextureAtlas.
const CCRect & getTextureRect (void) 返回精灵大小
  returns the rect of the CCSprite in points
bool isUsesBatchNode (void) 判断精灵是否在 CCSpriteBatchNode 渲染
  whether or not the Sprite is rendered using a CCSpriteBatchNode
void setUsesSpriteBatchNode (bool bUsesSpriteBatchNode) 设置该精灵对象在 CCSpriteBatchNode 中被渲染
  make the Sprite been rendered using a CCSpriteBatchNode
CCTextureAtlas * getTextureAtlas (void) 获取设置地图纹理
void setTextureAtlas (CCTextureAtlas *pobTextureAtlas)
CCSpriteBatchNode * getSpriteBatchNode (void) 设置和获取一批精灵集
void setSpriteBatchNode (CCSpriteBatchNode *pobSpriteBatchNode)
ccHonorParentTransform getHonorParentTransform (void) 是否根据其父的矩阵变化而改变
  whether or not to transform according to its parent transformations.
void setHonorParentTransform (ccHonorParentTransform eHonorParentTransform)
  whether or not to transform according to its parent transformations.
const CCPoint & getOffsetPositionInPixels (void) 获取便宜位置(象素)
  Get offset position of the sprite.
ccBlendFunc getBlendFunc (void) 设置获取混合方法
  conforms to CCTextureProtocol protocol
void setBlendFunc (ccBlendFunc blendFunc)
  conforms to CCTextureProtocol protocol
  CCSprite (void)
virtual ~CCSprite (void)
virtual bool init (void)
virtual void removeChild (CCNode *pChild, bool bCleanup) 移除孩子 是否清理action
  Removes a child from the container.
virtual void removeAllChildrenWithCleanup (bool bCleanup)
  Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
virtual void reorderChild (CCNode *pChild, int zOrder) 移除孩子由zOrder决定
  Reorders a child according to a new z value.
virtual void addChild (CCNode *pChild)
  Adds a child to the container with z-order as 0.
virtual void addChild (CCNode *pChild, int zOrder)
  Adds a child to the container with a z-order If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
virtual void addChild (CCNode *pChild, int zOrder, int tag)
  Adds a child to the container with z order and tag If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
virtual void setDirtyRecursively (bool bValue)
virtual void setPosition (const CCPoint &pos) 设置位置
  setPosition
virtual void setPositionInPixels (const CCPoint &pos) 设置位置(象素)
  setPositionInPixels
virtual void setRotation (float fRotation) 设置旋转
  setRotation
virtual void setSkewX (float sx) 设置倾斜XY
  setSkewX
virtual void setSkewY (float sy)
  setSkewY
virtual void setScaleX (float fScaleX) 设置放大缩小
  setScaleX
virtual void setScaleY (float fScaleY)
  setScaleY
virtual void setScale (float fScale)
  The scale factor of the node.
virtual void setVertexZ (float fVertexZ) 设置Z轴顶点坐标
  setVertexZ
virtual void setAnchorPoint (const CCPoint &anchor) 设置锚点坐标
  setAnchorPoint
virtual void setIsRelativeAnchorPoint (bool bRelative) 设置是否相对锚点坐标
  setIsRelativeAnchorPoint
virtual void setIsVisible (bool bVisible) 设置是否可见
  setIsVisible
void setFlipX (bool bFlipX) 设置X翻转Y翻转
void setFlipY (bool bFlipY)
bool isFlipX (void)
  whether or not the sprite is flipped horizontally.
bool isFlipY (void)
  whether or not the sprite is flipped vertically.
void updateColor (void)
virtual void setIsOpacityModifyRGB (bool bValue) 设置是否RGB透明修饰
  opacity: conforms to CCRGBAProtocol protocol
virtual bool getIsOpacityModifyRGB (void)
  returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
virtual void setTexture (CCTexture2D *texture) 设置纹理
virtual CCTexture2D * getTexture (void)
bool initWithTexture (CCTexture2D *pTexture) 初始化精灵精灵通过纹理
  Initializes an sprite with a texture.
bool initWithTexture (CCTexture2D *pTexture, const CCRect &rect) 初始化sprite通过纹理和矩形
  Initializes an sprite with a texture and a rect.
bool initWithSpriteFrame (CCSpriteFrame *pSpriteFrame)初始化精灵通过精灵帧
bool initWithSpriteFrameName (const char *pszSpriteFrameName)
  Initializes an sprite with an sprite frame name. 初始化精灵通过一个精灵帧名称
bool initWithFile (const char *pszFilename)初始化精灵通过一个图片地址
  Initializes an sprite with an image filename.
bool initWithFile (const char *pszFilename, const CCRect &rect)
  Initializes an sprite with an image filename, and a rect. 初始化精灵通过一个图片地址和矩形
bool initWithBatchNode (CCSpriteBatchNode *batchNode, const CCRect &rect)初始化精灵通过精灵集合和一个矩形
  Initializes an sprite with an CCSpriteBatchNode and a rect in points.
bool initWithBatchNodeRectInPixels (CCSpriteBatchNode *batchNode, const CCRect &rect)
  Initializes an sprite with an CCSpriteBatchNode and a rect in pixels.
void updateTransform (void) 更新矩阵
  updates the quad according the the rotation, position, scale values.
void useSelfRender (void)使用自身渲染
  tell the sprite to use self-render.
void setTextureRect (const CCRect &rect)更新精灵在纹理上的矩形
  

补充:移动开发 , 其他 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,