Label::Label() : SpriteBatch(NULL) , m_string() , m_color(fzWHITE) , m_alignment(kFZLabelAlignment_left) , m_verticalPadding(0) , m_horizontalPadding(0) , p_font(NULL) { setIsRelativeAnchorPoint(true); setAnchorPoint(0.5f, 0.5f); setContentSize(FZSizeZero); }
bool CCControlSlider::initWithSprites(CCSprite * backgroundSprite, CCSprite* progessSprite, CCMenuItem* thumbItem) { if (CCControl::init()) { setIsRelativeAnchorPoint(true); setIsTouchEnabled(true); m_backgroundSprite=backgroundSprite; m_progressSprite=progessSprite; m_thumbItem=thumbItem; // Defines the content size CCRect maxRect = CCControlUtils::CCRectUnion(backgroundSprite->boundingBox(), thumbItem->boundingBox()); CCSize size=CCSizeMake(maxRect.size.width+2*SLIDER_MARGIN_H, maxRect.size.height+2*SLIDER_MARGIN_V); setContentSize(size); //setContentSize(CCSizeMake(backgroundSprite->getContentSize().width, thumbItem->getContentSize().height)); // Add the slider background m_backgroundSprite->setAnchorPoint(ccp(0.5f, 0.5f)); m_backgroundSprite->setPosition(ccp(size.width / 2, size.height / 2)); addChild(m_backgroundSprite); // Add the progress bar m_progressSprite->setAnchorPoint(ccp(0.0f, 0.5f)); m_progressSprite->setPosition(ccp(0.0f+SLIDER_MARGIN_H, size.height / 2)); addChild(m_progressSprite); // Add the slider thumb m_thumbItem->setPosition(ccp(0+SLIDER_MARGIN_H, size.height / 2)); addChild(m_thumbItem); // Init default values m_minimumValue = 0.0f; m_maximumValue = 1.0f; m_snappingInterval=-1.0f; setValue(m_minimumValue); return true; } else { return false; } }
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 }