Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: String sub rectangle  (Read 6398 times)

0 Members and 1 Guest are viewing this topic.

Thratur

  • Newbie
  • *
  • Posts: 5
    • View Profile
String sub rectangle
« 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.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
String sub rectangle
« Reply #1 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.

Thratur

  • Newbie
  • *
  • Posts: 5
    • View Profile
String sub rectangle
« Reply #2 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!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
String sub rectangle
« Reply #3 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 ;)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
String sub rectangle
« Reply #4 on: August 28, 2009, 04:27:28 pm »
Will those masks be added to SFML2, too?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
String sub rectangle
« Reply #5 on: August 28, 2009, 04:44:48 pm »
If I can come up with a robust and clean public API, hopefully yes :)
Laurent Gomila - SFML developer

Thratur

  • Newbie
  • *
  • Posts: 5
    • View Profile
String sub rectangle
« Reply #6 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.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
String sub rectangle
« Reply #7 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 ;))

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
String sub rectangle
« Reply #8 on: September 05, 2009, 07:24:02 pm »
Yes, it would be a generic feature that would apply to everything that is rendered.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
String sub rectangle
« Reply #9 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.

 

anything