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.
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() });
}
Images:
Looking right :
http://puu.sh/nT5FY/eb708201f9.pngLooking left :
http://puu.sh/nT5Hp/d3d04b2ee5.pngSprite :
http://puu.sh/nT5IO/0d4937a37d.pngI don't know if I made something wrong on my code, or if it's just a bug...
Peace.