SFML community forums

General => Feature requests => Topic started by: kolofsson on April 25, 2010, 01:50:20 pm

Title: Load sf::Sprite as a subrect of sf::Image
Post by: kolofsson on April 25, 2010, 01:50:20 pm
Hello. I'd like to ask, if it would be possible to implement a method to the sf:Sprite class that would look sth like this:

Code: [Select]
sf::Sprite::SetImageRect(sf::Image, sf::Rect)

If I am right, the problem with displaying large images lies on the sprite side. So if I could load a large image with sf::Image and then slice it into smaller subrectangles, supported by the graphics cards, and make sprites of them.

Is this doable? Or do I have to split the image manually to ensure, that my sprite is not too big for some old hardware? Thanks.
Title: Load sf::Sprite as a subrect of sf::Image
Post by: Nexus on April 25, 2010, 02:09:38 pm
You are probably looking for sf::Sprite::SetSubRect(). ;)
Title: Load sf::Sprite as a subrect of sf::Image
Post by: nulloid on April 25, 2010, 04:05:11 pm
I think he wants something similar to Mappy (http://www.sfml-dev.org/forum/viewtopic.php?t=2340). I don't know what he wants exactly, nor what Mappy is good for (just in contours), but maybe it worths a look :)

Read this: http://www.sfml-dev.org/forum/viewtopic.php?t=2508
Title: Load sf::Sprite as a subrect of sf::Image
Post by: Laurent on April 25, 2010, 04:14:13 pm
Quote
If I am right, the problem with displaying large images lies on the sprite side

Wrong, it lies 100% on the sf::Image side ;)

If the solution was that easy, it would already be implemented in SFML, trust me.
Title: Load sf::Sprite as a subrect of sf::Image
Post by: kolofsson on April 25, 2010, 07:40:32 pm
Quote from: "nulloid"
I don't know what he wants exactly


Let me explain. Old graphic cards support very small textures, even 256x256 pixels. If you try to load an image using SFML, that is larger than this, you will get an error.

Support for textures of 2048x2048 pixels is common, but what about these poor guys who won't be able to load your program, only because the textures are too big?