| 324 | } |
| 325 | |
| 326 | void Button::loadTexturePressed(std::string_view selected, TextureResType texType) |
| 327 | { |
| 328 | _clickedFileName = selected; |
| 329 | _pressedTexType = texType; |
| 330 | bool textureLoaded = true; |
| 331 | if (selected.empty()) |
| 332 | { |
| 333 | _buttonClickedRenderer->resetRender(); |
| 334 | textureLoaded = false; |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | switch (texType) |
| 339 | { |
| 340 | case TextureResType::LOCAL: |
| 341 | _buttonClickedRenderer->initWithFile(selected); |
| 342 | break; |
| 343 | case TextureResType::PLIST: |
| 344 | _buttonClickedRenderer->initWithSpriteFrameName(selected); |
| 345 | break; |
| 346 | default: |
| 347 | break; |
| 348 | } |
| 349 | } |
| 350 | this->setupPressedTexture(textureLoaded); |
| 351 | } |
| 352 | |
| 353 | void Button::setupPressedTexture(bool textureLoaded) |
| 354 | { |