I know that you can flip a sprite along its axes with setScale, but is it possible to flip a texture? I need to mirror a texture along its vertical axis.
Update: As a temporary solution I have implemented my own mirroring method. However this requires converting the texture to an image and back again. A solution which would manipulate the texture itself would be preferable.
sf::Image UTIL_flipImage(sf::Image *pImage)
{
sf::Vector2u sourceImageDimensions = pImage->getSize();
sf::Image result;
result.create(sourceImageDimensions.x, sourceImageDimensions.y);
for ( int16_t sourceImageRowIndex = 0; sourceImageRowIndex < sourceImageDimensions.y; sourceImageRowIndex++ )
{
for( int16_t rowPixelIndex = 0; rowPixelIndex < sourceImageDimensions.x; rowPixelIndex++ )
{
result.setPixel(rowPixelIndex, sourceImageRowIndex, pImage->getPixel(sourceImageDimensions.x - (rowPixelIndex + 1), sourceImageRowIndex) );
}
}
return result;
}