SFML community forums

Help => Graphics => Topic started by: ThatOneGuyThatDoesStuff on May 18, 2020, 10:26:08 pm

Title: Is there a way to create a sprite containing multiple other textures?
Post by: ThatOneGuyThatDoesStuff on May 18, 2020, 10:26:08 pm
What I want to do is create an sf::Sprite that is a compilation of a number of other given sprites/textures.

e.g. If I had 4 16x16 textures, I want to create a sprite that is 64x64 that contains those 4 smaller textures in a specific pattern. Is there any way I can do this, or something similar?
Title: Re: Is there a way to create a sprite containing multiple other textures?
Post by: Laurent on May 18, 2020, 11:10:02 pm
You can't create a sprite with multiple textures directly, but you can create a single texture from them, and then map that texture to a sprite.

See sf::RenderTexture for more details.
Title: Re: Is there a way to create a sprite containing multiple other textures?
Post by: ThatOneGuyThatDoesStuff on May 18, 2020, 11:20:14 pm
Ahhh, excellent. I was hoping it would be something simple. Than you kindly.