| 128 | } |
| 129 | |
| 130 | void LoadingBar::loadTexture(std::string_view texture, TextureResType texType) |
| 131 | { |
| 132 | if (texture.empty()) |
| 133 | { |
| 134 | return; |
| 135 | } |
| 136 | _textureFile = texture; |
| 137 | _renderBarTexType = texType; |
| 138 | switch (_renderBarTexType) |
| 139 | { |
| 140 | case TextureResType::LOCAL: |
| 141 | _barRenderer->setTexture(texture); |
| 142 | break; |
| 143 | case TextureResType::PLIST: |
| 144 | _barRenderer->setSpriteFrame(texture); |
| 145 | break; |
| 146 | default: |
| 147 | break; |
| 148 | } |
| 149 | |
| 150 | // FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249 |
| 151 | if (!_ignoreSize && _customSize.equals(Vec2::ZERO)) |
| 152 | { |
| 153 | _customSize = _barRenderer->getContentSize(); |
| 154 | } |
| 155 | this->setupTexture(); |
| 156 | } |
| 157 | |
| 158 | void LoadingBar::loadTexture(SpriteFrame* spriteframe) |
| 159 | { |
no test coverage detected