MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / updateBGImage

Method updateBGImage

Source/ButtonSprite.cpp:147–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void ButtonSprite::updateBGImage(std::string_view file)
148{
149 if (_buttonTexture)
150 {
151 _buttonTexture->removeFromParent();
152
153 _buttonTexture = ax::ui::Scale9Sprite::create(file, ax::Rect(0, 0, 40, 40));
154 _buttonTexture->setContentSize({ 16, 16 });
155
156 this->addChild(_buttonTexture, 0);
157
158 if (_hasTextProvided)
159 this->setString(_label->getString());
160 else
161 this->updateSpriteBGSize();
162 }
163 else
164 {
165 if (_subBGSprite)
166 {
167 _subBGSprite->setTexture(Director::getInstance()->getTextureCache()->addImage(file));
168 }
169 }
170}
171
172void ButtonSprite::setString(std::string_view str)
173{

Callers

nothing calls this directly

Calls 4

setStringMethod · 0.95
updateSpriteBGSizeMethod · 0.95
createFunction · 0.85
getStringMethod · 0.80

Tested by

no test coverage detected