void CheckBox::updateTextureRGBA() { updateRGBAToRenderer(_backGroundBoxRenderer); updateRGBAToRenderer(_backGroundSelectedBoxRenderer); updateRGBAToRenderer(_frontCrossRenderer); updateRGBAToRenderer(_backGroundBoxDisabledRenderer); updateRGBAToRenderer(_frontCrossDisabledRenderer); }
void Slider::updateTextureRGBA() { updateRGBAToRenderer(_barRenderer); updateRGBAToRenderer(_progressBarRenderer); updateRGBAToRenderer(_slidBallNormalRenderer); updateRGBAToRenderer(_slidBallPressedRenderer); updateRGBAToRenderer(_slidBallDisabledRenderer); }
void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResType texType) { if (backGround.empty()) { return; } _backGroundFileName = backGround; _backGroundTexType = texType; switch (_backGroundTexType) { case TextureResType::LOCAL: _backGroundBoxRenderer->setTexture(backGround); break; case TextureResType::PLIST: _backGroundBoxRenderer->setSpriteFrame(backGround); break; default: break; } updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_backGroundBoxRenderer); updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize()); _backGroundBoxRendererAdaptDirty = true; }
void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType) { if (backGroundSelected.empty()) { return; } _backGroundSelectedFileName = backGroundSelected; _backGroundSelectedTexType = texType; switch (_backGroundSelectedTexType) { case UI_TEX_TYPE_LOCAL: _backGroundSelectedBoxRenderer->setTexture(backGroundSelected); break; case UI_TEX_TYPE_PLIST: _backGroundSelectedBoxRenderer->setSpriteFrame(backGroundSelected); break; default: break; } backGroundSelectedTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_backGroundSelectedBoxRenderer); }
void CheckBox::loadTextureFrontCross(const char *cross,TextureResType texType) { if (!cross || strcmp(cross, "") == 0) { return; } _frontCrossFileName = cross; _frontCrossTexType = texType; switch (_frontCrossTexType) { case UI_TEX_TYPE_LOCAL: _frontCrossRenderer->setTexture(cross); break; case UI_TEX_TYPE_PLIST: _frontCrossRenderer->setSpriteFrame(cross); break; default: break; } frontCrossTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_frontCrossRenderer); }
void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType) { if (frontCrossDisabled.empty()) { return; } _frontCrossDisabledFileName = frontCrossDisabled; _frontCrossDisabledTexType = texType; switch (_frontCrossDisabledTexType) { case UI_TEX_TYPE_LOCAL: _frontCrossDisabledRenderer->setTexture(frontCrossDisabled); break; case UI_TEX_TYPE_PLIST: _frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled); break; default: break; } frontCrossDisabledTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_frontCrossDisabledRenderer); }
void CheckBox::loadTextureBackGroundDisabled(const char *backGroundDisabled,TextureResType texType) { if (!backGroundDisabled || strcmp(backGroundDisabled, "") == 0) { return; } _backGroundDisabledFileName = backGroundDisabled; _backGroundDisabledTexType = texType; switch (_backGroundDisabledTexType) { case UI_TEX_TYPE_LOCAL: _backGroundBoxDisabledRenderer->setTexture(backGroundDisabled); break; case UI_TEX_TYPE_PLIST: _backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled); break; default: break; } backGroundDisabledTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_backGroundBoxDisabledRenderer); }
void LoadingBar::loadTexture(const std::string& texture,TextureResType texType) { if (texture.empty()) { return; } _renderBarTexType = texType; _textureFile = texture; switch (_renderBarTexType) { case UI_TEX_TYPE_LOCAL: if (_scale9Enabled) { extension::Scale9Sprite* barRendererScale9 = static_cast<extension::Scale9Sprite*>(_barRenderer); barRendererScale9->initWithFile(texture); barRendererScale9->setCapInsets(_capInsets); } else { static_cast<Sprite*>(_barRenderer)->setTexture(texture); } break; case UI_TEX_TYPE_PLIST: if (_scale9Enabled) { extension::Scale9Sprite* barRendererScale9 = static_cast<extension::Scale9Sprite*>(_barRenderer); barRendererScale9->initWithSpriteFrameName(texture); barRendererScale9->setCapInsets(_capInsets); } else { static_cast<Sprite*>(_barRenderer)->setSpriteFrame(texture); } break; default: break; } updateRGBAToRenderer(_barRenderer); _barRendererTextureSize = _barRenderer->getContentSize(); switch (_barType) { case LoadingBarTypeLeft: _barRenderer->setAnchorPoint(Point(0.0f,0.5f)); if (!_scale9Enabled) { static_cast<Sprite*>(_barRenderer)->setFlippedX(false); } break; case LoadingBarTypeRight: _barRenderer->setAnchorPoint(Point(1.0f,0.5f)); if (!_scale9Enabled) { static_cast<Sprite*>(_barRenderer)->setFlippedX(true); } break; } barRendererScaleChangedWithSize(); }
void Button::loadTextureNormal(const std::string& normal,TextureResType texType) { if (normal.empty()) { return; } _normalFileName = normal; _normalTexType = texType; if (_scale9Enabled) { extension::Scale9Sprite* normalRendererScale9 = static_cast<extension::Scale9Sprite*>(_buttonNormalRenderer); switch (_normalTexType) { case TextureResType::LOCAL: normalRendererScale9->initWithFile(normal); break; case TextureResType::PLIST: normalRendererScale9->initWithSpriteFrameName(normal); break; default: break; } normalRendererScale9->setCapInsets(_capInsetsNormal); } else { Sprite* normalRenderer = static_cast<Sprite*>(_buttonNormalRenderer); switch (_normalTexType) { case TextureResType::LOCAL: normalRenderer->setTexture(normal); break; case TextureResType::PLIST: normalRenderer->setSpriteFrame(normal); break; default: break; } } _normalTextureSize = _buttonNormalRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_buttonNormalRenderer); updateContentSizeWithTextureSize(_normalTextureSize); _normalTextureLoaded = true; _normalTextureAdaptDirty = true; }
void Button::loadTextureDisabled(const std::string& disabled,TextureResType texType) { if (disabled.empty()) { return; } _disabledFileName = disabled; _disabledTexType = texType; if (_scale9Enabled) { extension::Scale9Sprite* disabledScale9 = static_cast<extension::Scale9Sprite*>(_buttonDisableRenderer); switch (_disabledTexType) { case UI_TEX_TYPE_LOCAL: disabledScale9->initWithFile(disabled); break; case UI_TEX_TYPE_PLIST: disabledScale9->initWithSpriteFrameName(disabled); break; default: break; } disabledScale9->setCapInsets(_capInsetsDisabled); } else { Sprite* disabledRenderer = static_cast<Sprite*>(_buttonDisableRenderer); switch (_disabledTexType) { case UI_TEX_TYPE_LOCAL: disabledRenderer->setTexture(disabled); break; case UI_TEX_TYPE_PLIST: disabledRenderer->setSpriteFrame(disabled); break; default: break; } } _disabledTextureSize = _buttonDisableRenderer->getContentSize(); disabledTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_buttonDisableRenderer); _disabledTextureLoaded = true; }
void Button::loadTexturePressed(const char* selected,TextureResType texType) { if (!selected || strcmp(selected, "") == 0) { return; } _clickedFileName = selected; _pressedTexType = texType; if (_scale9Enabled) { extension::CCScale9Sprite* clickedRendererScale9 = static_cast<extension::CCScale9Sprite*>(_buttonClickedRenderer); switch (_pressedTexType) { case UI_TEX_TYPE_LOCAL: clickedRendererScale9->initWithFile(selected); break; case UI_TEX_TYPE_PLIST: clickedRendererScale9->initWithSpriteFrameName(selected); break; default: break; } clickedRendererScale9->setCapInsets(_capInsetsPressed); } else { CCSprite* clickedRenderer = static_cast<CCSprite*>(_buttonClickedRenderer); switch (_pressedTexType) { case UI_TEX_TYPE_LOCAL: clickedRenderer->initWithFile(selected); break; case UI_TEX_TYPE_PLIST: clickedRenderer->initWithSpriteFrameName(selected); break; default: break; } } _pressedTextureSize = _buttonClickedRenderer->getContentSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_buttonClickedRenderer); pressedTextureScaleChangedWithSize(); _pressedTextureLoaded = true; }
void Button::loadTextureNormal(const char* normal,TextureResType texType) { if (!normal || strcmp(normal, "") == 0) { return; } _normalFileName = normal; _normalTexType = texType; if (_scale9Enabled) { extension::CCScale9Sprite* normalRendererScale9 = static_cast<extension::CCScale9Sprite*>(_buttonNormalRenderer); switch (_normalTexType) { case UI_TEX_TYPE_LOCAL: normalRendererScale9->initWithFile(normal); break; case UI_TEX_TYPE_PLIST: normalRendererScale9->initWithSpriteFrameName(normal); break; default: break; } normalRendererScale9->setCapInsets(_capInsetsNormal); } else { CCSprite* normalRenderer = static_cast<CCSprite*>(_buttonNormalRenderer); switch (_normalTexType) { case UI_TEX_TYPE_LOCAL: normalRenderer->initWithFile(normal); break; case UI_TEX_TYPE_PLIST: normalRenderer->initWithSpriteFrameName(normal); break; default: break; } } _normalTextureSize = _buttonNormalRenderer->getContentSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_buttonNormalRenderer); normalTextureScaleChangedWithSize(); _normalTextureLoaded = true; }
void ImageView::loadTexture(const char *fileName, TextureResType texType) { if (!fileName || strcmp(fileName, "") == 0) { return; } _textureFile = fileName; _imageTexType = texType; switch (_imageTexType) { case UI_TEX_TYPE_LOCAL: if (_scale9Enabled) { extension::CCScale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; imageRendererScale9->initWithFile(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { CCSprite* imageRenderer = STATIC_CAST_CCSPRITE; imageRenderer->initWithFile(fileName); } break; case UI_TEX_TYPE_PLIST: if (_scale9Enabled) { extension::CCScale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; imageRendererScale9->initWithSpriteFrameName(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { CCSprite* imageRenderer = STATIC_CAST_CCSPRITE; imageRenderer->initWithSpriteFrameName(fileName); } break; default: break; } _imageTextureSize = _imageRenderer->getContentSize(); imageTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_imageRenderer); }
void ImageView::loadTexture(const std::string& fileName, TextureResType texType) { if (fileName.empty()) { return; } _textureFile = fileName; _imageTexType = texType; switch (_imageTexType) { case TextureResType::LOCAL: if (_scale9Enabled) { extension::Scale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; imageRendererScale9->initWithFile(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { Sprite* imageRenderer = STATIC_CAST_CCSPRITE; imageRenderer->setTexture(fileName); } break; case TextureResType::PLIST: if (_scale9Enabled) { extension::Scale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; imageRendererScale9->initWithSpriteFrameName(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { Sprite* imageRenderer = STATIC_CAST_CCSPRITE; imageRenderer->setSpriteFrame(fileName); } break; default: break; } _imageTextureSize = _imageRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_imageRenderer); updateContentSizeWithTextureSize(_imageTextureSize); _imageRendererAdaptDirty = true; }
void Button::loadTexturePressed(const std::string& selected,TextureResType texType) { if (selected.empty()) { return; } _clickedFileName = selected; _pressedTexType = texType; if (_scale9Enabled) { extension::Scale9Sprite* clickedRendererScale9 = static_cast<extension::Scale9Sprite*>(_buttonClickedRenderer); switch (_pressedTexType) { case TextureResType::LOCAL: clickedRendererScale9->initWithFile(selected); break; case TextureResType::PLIST: clickedRendererScale9->initWithSpriteFrameName(selected); break; default: break; } clickedRendererScale9->setCapInsets(_capInsetsPressed); } else { Sprite* clickedRenderer = static_cast<Sprite*>(_buttonClickedRenderer); switch (_pressedTexType) { case TextureResType::LOCAL: clickedRenderer->setTexture(selected); break; case TextureResType::PLIST: clickedRenderer->setSpriteFrame(selected); break; default: break; } } _pressedTextureSize = _buttonClickedRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_buttonDisableRenderer); _pressedTextureLoaded = true; _pressedTextureAdaptDirty = true; }
void ImageView::loadTex(cocos2d::CCTexture2D *tex) { switch (_imageTexType) { case UI_TEX_TYPE_LOCAL: if (_scale9Enabled) { extension::CCScale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; //imageRendererScale9->initWithFile(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { CCSprite* imageRenderer = STATIC_CAST_CCSPRITE; //imageRenderer->initWithFile(fileName); imageRenderer->initWithTexture(tex); } break; case UI_TEX_TYPE_PLIST: if (_scale9Enabled) { extension::CCScale9Sprite* imageRendererScale9 = STATIC_CAST_SCALE9SPRITE; //imageRendererScale9->initWithSpriteFrameName(fileName); imageRendererScale9->setCapInsets(_capInsets); } else { CCSprite* imageRenderer = STATIC_CAST_CCSPRITE; //imageRenderer->initWithSpriteFrameName(fileName); imageRenderer->initWithTexture(tex); } break; default: break; } _imageTextureSize = _imageRenderer->getContentSize(); imageTextureScaleChangedWithSize(); updateAnchorPoint(); updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_imageRenderer); }
void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType) { if (disabled.empty()) { return; } _slidBallDisabledTextureFile = disabled; _ballDTexType = texType; switch (_ballDTexType) { case TextureResType::LOCAL: _slidBallDisabledRenderer->setTexture(disabled); break; case TextureResType::PLIST: _slidBallDisabledRenderer->setSpriteFrame(disabled); break; default: break; } updateRGBAToRenderer(_slidBallDisabledRenderer); }
void Slider::loadSlidBallTextureDisabled(const char* disabled,TextureResType texType) { if (!disabled || strcmp(disabled, "") == 0) { return; } _slidBallDisabledTextureFile = disabled; _ballDTexType = texType; switch (_ballDTexType) { case UI_TEX_TYPE_LOCAL: _slidBallDisabledRenderer->initWithFile(disabled); break; case UI_TEX_TYPE_PLIST: _slidBallDisabledRenderer->initWithSpriteFrameName(disabled); break; default: break; } updateRGBAToRenderer(_slidBallDisabledRenderer); }
void Slider::loadSlidBallTextureNormal(const char* normal,TextureResType texType) { if (!normal || strcmp(normal, "") == 0) { return; } _slidBallNormalTextureFile = normal; _ballNTexType = texType; switch (_ballNTexType) { case UI_TEX_TYPE_LOCAL: _slidBallNormalRenderer->initWithFile(normal); break; case UI_TEX_TYPE_PLIST: _slidBallNormalRenderer->initWithSpriteFrameName(normal); break; default: break; } updateRGBAToRenderer(_slidBallNormalRenderer); }
void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType texType) { if (normal.empty()) { return; } _slidBallNormalTextureFile = normal; _ballNTexType = texType; switch (_ballNTexType) { case TextureResType::LOCAL: _slidBallNormalRenderer->setTexture(normal); break; case TextureResType::PLIST: _slidBallNormalRenderer->setSpriteFrame(normal); break; default: break; } updateRGBAToRenderer(_slidBallNormalRenderer); }
void Slider::loadProgressBarTexture(const char *fileName, TextureResType texType) { if (!fileName || strcmp(fileName, "") == 0) { return; } _progressBarTextureFile = fileName; _progressBarTexType = texType; switch (_progressBarTexType) { case UI_TEX_TYPE_LOCAL: if (_scale9Enabled) { static_cast<extension::CCScale9Sprite*>(_progressBarRenderer)->initWithFile(fileName); } else { static_cast<CCSprite*>(_progressBarRenderer)->initWithFile(fileName); } break; case UI_TEX_TYPE_PLIST: if (_scale9Enabled) { static_cast<extension::CCScale9Sprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName); } else { static_cast<CCSprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName); } break; default: break; } updateRGBAToRenderer(_progressBarRenderer); _progressBarRenderer->setAnchorPoint(CCPoint(0.0f, 0.5f)); _progressBarTextureSize = _progressBarRenderer->getContentSize(); progressBarRendererScaleChangedWithSize(); }
void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType texType) { if (fileName.empty()) { return; } _progressBarTextureFile = fileName; _progressBarTexType = texType; switch (_progressBarTexType) { case TextureResType::LOCAL: if (_scale9Enabled) { static_cast<extension::Scale9Sprite*>(_progressBarRenderer)->initWithFile(fileName); } else { static_cast<Sprite*>(_progressBarRenderer)->setTexture(fileName); } break; case TextureResType::PLIST: if (_scale9Enabled) { static_cast<extension::Scale9Sprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName); } else { static_cast<Sprite*>(_progressBarRenderer)->setSpriteFrame(fileName); } break; default: break; } updateRGBAToRenderer(_progressBarRenderer); _progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f)); _progressBarTextureSize = _progressBarRenderer->getContentSize(); _progressBarRendererDirty = true; }
void Slider::loadBarTexture(const char* fileName, TextureResType texType) { if (!fileName || strcmp(fileName, "") == 0) { return; } _textureFile = fileName; _barTexType = texType; switch (_barTexType) { case UI_TEX_TYPE_LOCAL: if (_scale9Enabled) { static_cast<CCScale9Sprite*>(_barRenderer)->initWithFile(fileName); } else { static_cast<CCSprite*>(_barRenderer)->initWithFile(fileName); } break; case UI_TEX_TYPE_PLIST: if (_scale9Enabled) { static_cast<CCScale9Sprite*>(_barRenderer)->initWithSpriteFrameName(fileName); } else { static_cast<CCSprite*>(_barRenderer)->initWithSpriteFrameName(fileName); } break; default: break; } updateRGBAToRenderer(_barRenderer); barRendererScaleChangedWithSize(); progressBarRendererScaleChangedWithSize(); }
void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType) { if (frontCrossDisabled.empty()) { return; } _frontCrossDisabledFileName = frontCrossDisabled; _frontCrossDisabledTexType = texType; switch (_frontCrossDisabledTexType) { case TextureResType::LOCAL: _frontCrossDisabledRenderer->setTexture(frontCrossDisabled); break; case TextureResType::PLIST: _frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled); break; default: break; } updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_frontCrossDisabledRenderer); _frontCrossDisabledRendererAdaptDirty = true; }
void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType) { if (backGroundDisabled.empty()) { return; } _backGroundDisabledFileName = backGroundDisabled; _backGroundDisabledTexType = texType; switch (_backGroundDisabledTexType) { case UI_TEX_TYPE_LOCAL: _backGroundBoxDisabledRenderer->setTexture(backGroundDisabled); break; case UI_TEX_TYPE_PLIST: _backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled); break; default: break; } updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_backGroundBoxDisabledRenderer); _backGroundBoxDisabledRendererAdaptDirty = true; }
void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType texType) { if (cross.empty()) { return; } _frontCrossFileName = cross; _frontCrossTexType = texType; switch (_frontCrossTexType) { case UI_TEX_TYPE_LOCAL: _frontCrossRenderer->setTexture(cross); break; case UI_TEX_TYPE_PLIST: _frontCrossRenderer->setSpriteFrame(cross); break; default: break; } updateFlippedX(); updateFlippedY(); updateRGBAToRenderer(_frontCrossRenderer); _frontCrossRendererAdaptDirty = true; }
void LoadingBar::updateTextureRGBA() { updateRGBAToRenderer(_barRenderer); }
void Text::updateTextureRGBA() { updateRGBAToRenderer(_labelRenderer); }
void TextAtlas::updateTextureRGBA() { updateRGBAToRenderer(_labelAtlasRenderer); }
void TextField::updateTextureRGBA() { updateRGBAToRenderer(_textFieldRenderer); }