mirror of https://github.com/axmolengine/axmol.git
fix crash in LoadingBar
This commit is contained in:
parent
4a2edc8ce8
commit
ec20b48775
|
@ -282,11 +282,14 @@ void LoadingBar::updateProgressBar()
|
|||
}
|
||||
else
|
||||
{
|
||||
float res = _percent / 100.0f;
|
||||
Sprite* spriteRenderer = _barRenderer->getSprite();
|
||||
Rect rect = spriteRenderer->getTextureRect();
|
||||
rect.size.width = _barRendererTextureSize.width * res;
|
||||
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
|
||||
Sprite* innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
float res = _percent / 100.0f;
|
||||
Rect rect = innerSprite->getTextureRect();
|
||||
rect.size.width = _barRendererTextureSize.width * res;
|
||||
innerSprite->setTextureRect(rect, innerSprite->isTextureRectRotated(), rect.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue