SFML community forums

General => Feature requests => Topic started by: Thratur on August 27, 2009, 05:44:52 pm

Title: String sub rectangle
Post by: Thratur on August 27, 2009, 05:44:52 pm
Hi!

I was using SDL for a long time and I used SDL_TTF.  Later, I installed SFML and I was very happy about it.  I like it a lot and it is much more simpler and strings are better than with SDL_TTF by far.  However, there's one thing I can't do with SFML that I could with SDL_TTF, because it was a big texture rather than small letters textures.  I can't take my string and cut it where I want just to have a part of a letter and the rest of the string or any other sub rectangle.

I think it would be nice to have a function that takes the sub rectangle coordinates and draw a sub part of the string or that return a sf::sprite that I could then sub-rect myself without any problem.

I may have forgot a function that could do that, but I looked for a while in the documentation, and I couldn't find anything.  So, what do you think of my idea?  I won't care if it's a bad suggestion.
Title: String sub rectangle
Post by: dabo on August 27, 2009, 06:12:26 pm
Render to image will (is?) be implemented in SFML 2, I believe that's what you want.
Title: String sub rectangle
Post by: Thratur on August 27, 2009, 08:10:42 pm
Well, if we'll be able to do that in SFML2, then there isn't any problem.

However, I believe that the first solution (directly drawing the sub rectangle from the string) would be lighter, easier to add, and simpler to use.

Thanks for the answer!
Title: String sub rectangle
Post by: Laurent on August 28, 2009, 02:03:58 pm
sf::String will be rewritten in SFML 2. Plus, clipping masks may also be added soon. So don't worry, you just have to wait ;)
Title: String sub rectangle
Post by: Tank on August 28, 2009, 04:27:28 pm
Will those masks be added to SFML2, too?
Title: String sub rectangle
Post by: Laurent on August 28, 2009, 04:44:48 pm
If I can come up with a robust and clean public API, hopefully yes :)
Title: String sub rectangle
Post by: Thratur on August 28, 2009, 09:24:15 pm
Hi,

thank you very much for the answer!  I'm happy that SFML 2 will handle this and I'll be waiting for it.
Title: String sub rectangle
Post by: Tank on September 05, 2009, 05:56:51 pm
Will that clipping mask be only available for sf::String or other sf::Drawables aswell? (sf::Sprite already has SetSubRect(); don't know if a clipping mask is wanted for other sf::Drawables).
If so, I'd suggest sf::String::SetClipMask( const sf::IntRect & ). ;)
(well, the main reason why I'm writing this is to bump the thread; a feature like this is hardly needed at my side ;))
Title: String sub rectangle
Post by: Laurent on September 05, 2009, 07:24:02 pm
Yes, it would be a generic feature that would apply to everything that is rendered.
Title: String sub rectangle
Post by: Tank on September 06, 2009, 09:54:18 pm
Okay, so I guess it'll take some time to get implemented. Anyway, thanks for the reply.