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

Author Topic: Random sf::String?  (Read 2723 times)

0 Members and 1 Guest are viewing this topic.

drew

  • Newbie
  • *
  • Posts: 11
    • View Profile
Random sf::String?
« on: August 11, 2009, 12:01:01 am »
How would I go about generating a random character to put into sf::String? I didn't see anything in sf::Randomizer to do that...

Thanks.

Imbue

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Random sf::String?
« Reply #1 on: August 11, 2009, 01:07:36 am »
You could try something like:
Code: [Select]
char random = 'a' + sf::Randomizer::Random(0, 25);For a random letter from 'a' to 'z'.

drew

  • Newbie
  • *
  • Posts: 11
    • View Profile
Random sf::String?
« Reply #2 on: August 11, 2009, 01:30:03 am »
Yeah but I'm wanting to put it into sf::String so it can be drawable using fonts. As far as I can tell sf::String constructor doesn't take std::string or char so I'm not sure what to do.

...oh I'm sorry. I just figured it out after digging through the sf::String and sf::Unicode docs. Apparently that's how! Alright so it's just passing std::string to sf::Unicode::Text and finally passing that to sf::String.

 

anything