bool CCSprite::init(void) { m_bDirty = m_bRecursiveDirty = false; // by default use "Self Render". // if the sprite is added to an SpriteSheet, then it will automatically switch to "SpriteSheet Render" useSelfRender(); m_bOpacityModifyRGB = true; m_nOpacity = 255; m_sColor = m_sColorUnmodified = ccWHITE; m_sBlendFunc.src = CC_BLEND_SRC; m_sBlendFunc.dst = CC_BLEND_DST; // update texture (calls updateBlendFunc) setTexture(NULL); // clean the Quad memset(&m_sQuad, 0, sizeof(m_sQuad)); m_bFlipX = m_bFlipY = false; // lazy alloc m_pAnimations = NULL; // default transform anchor: center m_tAnchorPoint = ccp(0.5f, 0.5f); // zwoptex default values m_obOffsetPositionInPixels = CGPointZero; m_eHonorParentTransform = CC_HONOR_PARENT_TRANSFORM_ALL; m_bHasChildren = false; // Atlas: Color ccColor4B tmpColor = { 255, 255, 255, 255 }; m_sQuad.bl.colors = tmpColor; m_sQuad.br.colors = tmpColor; m_sQuad.tl.colors = tmpColor; m_sQuad.tr.colors = tmpColor; // Atlas: Vertex // updated in "useSelfRender" // Atlas: TexCoords setTextureRectInPixels(CGRectZero, false, CGSizeZero); return true; }
Sprite::Sprite() : m_mode (kFZSprite_Uninitialized) , m_textureRect (FZRectZero) , m_offset (FZPointZero) , m_unflippedOffset (FZPointZero) , m_color (fzWHITE) , m_alpha (255) , m_rectRotated (false) , m_flipX (false) , m_flipY (false) , mode () { useSelfRender(); setIsRelativeAnchorPoint(true); setAnchorPoint(0.5f, 0.5f); #if FZ_GL_SHADERS // shader program setGLProgram(kFZShader_mat_uC4_TEX); #endif }