1
Graphics / Flipping sprite not working.
« on: March 25, 2016, 05:40:43 am »
Well, I was trying to flip a sprite using the following code, but it's not working, I'm getting a red square instead of my flipped sprite.
Images:
Looking right : http://puu.sh/nT5FY/eb708201f9.png
Looking left : http://puu.sh/nT5Hp/d3d04b2ee5.png
Sprite : http://puu.sh/nT5IO/0d4937a37d.png
I don't know if I made something wrong on my code, or if it's just a bug...
Peace.
if (pPhysics->getLeft())
{
//pRender->getSprite().setScale(-1, 1);
pRender->getSprite().setTextureRect(sf::IntRect{ (int)m_currentFrame * pRender->getWidth(), 0, pRender->getWidth(), -pRender->getHeight() });
}
else
{
//pRender->getSprite().setScale(1, 1);
pRender->getSprite().setTextureRect(sf::IntRect{ (int)m_currentFrame * pRender->getWidth(), 0, pRender->getWidth(), pRender->getHeight() });
}
{
//pRender->getSprite().setScale(-1, 1);
pRender->getSprite().setTextureRect(sf::IntRect{ (int)m_currentFrame * pRender->getWidth(), 0, pRender->getWidth(), -pRender->getHeight() });
}
else
{
//pRender->getSprite().setScale(1, 1);
pRender->getSprite().setTextureRect(sf::IntRect{ (int)m_currentFrame * pRender->getWidth(), 0, pRender->getWidth(), pRender->getHeight() });
}
Images:
Looking right : http://puu.sh/nT5FY/eb708201f9.png
Looking left : http://puu.sh/nT5Hp/d3d04b2ee5.png
Sprite : http://puu.sh/nT5IO/0d4937a37d.png
I don't know if I made something wrong on my code, or if it's just a bug...
Peace.