SFML community forums

Help => Graphics => Topic started by: slotdev on July 20, 2012, 02:47:53 pm

Title: getTexture for a SubRect / sprite
Post by: slotdev on July 20, 2012, 02:47:53 pm
Hi

I have loads of sprites, all derived from large tiles using SetSubRect. Now I need to be able to save to file each of these sprites. I can do a mySprite.getTexture and copy this to an sf::Image...but this is the entire tile for this sprite - not just the data for the small sub-rect.

Any ideas how to achieve this??

Many Thanks
Ed
Title: Re: getTexture for a SubRect / sprite
Post by: eXpl0it3r on July 20, 2012, 03:09:42 pm
Draw them all to a sf::RenderTexture retrieve the texture, convert to a image and save it. ;)
Title: Re: getTexture for a SubRect / sprite
Post by: slotdev on July 20, 2012, 04:26:19 pm
I managed to do it using a temporary sf::Image, copying data from a texture using copyToImage, and then saving it. It works perfectly :)

Thanks!