mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
Fixed Shape::setTextureRect not working when called before setTexture
This commit is contained in:
parent
86897a8347
commit
323aa4e3e7
@ -63,9 +63,12 @@ Shape::~Shape()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shape::setTexture(const Texture* texture, bool resetRect)
|
void Shape::setTexture(const Texture* texture, bool resetRect)
|
||||||
{
|
{
|
||||||
// Recompute the texture area if requested, or if there was no texture before
|
if (texture)
|
||||||
if (texture && (resetRect || !m_texture))
|
{
|
||||||
setTextureRect(IntRect(0, 0, texture->getSize().x, texture->getSize().y));
|
// Recompute the texture area if requested, or if there was no texture & rect before
|
||||||
|
if (resetRect || (!m_texture && (m_textureRect == sf::IntRect())))
|
||||||
|
setTextureRect(IntRect(0, 0, texture->getSize().x, texture->getSize().y));
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the new texture
|
// Assign the new texture
|
||||||
m_texture = texture;
|
m_texture = texture;
|
||||||
|
Loading…
Reference in New Issue
Block a user