Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mtbds

Pages: [1]
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.

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.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.

Pages: [1]
anything