SFML community forums
Help => Graphics => Topic started by: zilcho on July 21, 2012, 03:37:33 pm
-
Is it possible to stitch together an image from several smaller ones? I haven't been able to figure it out how to do it yet. I got an array with tiles and instead of iterating trough this array each loop to grab every single tile I'd like to create just one large image or sprite and draw.
-
You could do that with sf::RenderTexture (SFML 2). But note that your graphics card has a texture size limit, so maybe this isn't such a good idea. Also, you cannot only draw the tiles that are currently on the screen with this approach.
What's the problem of iterating through the tiles? Especially when your game gets more dynamic (for example with animated tiles), this way is much more flexible.
-
Using SFML 1.6 so I guess I'll have to upgrade and I wont be creating very large images so texture size limit wont be a problem.
I find it unnecessary to iterate trough all tiles when I don't have a need for it, any animation will be done on another level. The tiles are more of a way of generating data for the chunk which holds them.
-
Yes it's a good idea to upgrade to SFML 2.
If you want to draw something like a tilemap (as it seems like it) you can also use a Vertex Array in SFML 2. It's more flexible and you don't need to create larger textures but you can still draw it with a single draw call.