mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14055 from Dimon4eg/fix-crash-in-LoadingBar
fix crash in LoadingBar
This commit is contained in:
commit
e32e8b95a4
|
@ -281,12 +281,15 @@ void LoadingBar::updateProgressBar()
|
|||
setScale9Scale();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sprite* innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
float res = _percent / 100.0f;
|
||||
Sprite* spriteRenderer = _barRenderer->getSprite();
|
||||
Rect rect = spriteRenderer->getTextureRect();
|
||||
Rect rect = innerSprite->getTextureRect();
|
||||
rect.size.width = _barRendererTextureSize.width * res;
|
||||
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
|
||||
innerSprite->setTextureRect(rect, innerSprite->isTextureRectRotated(), rect.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue