SFML community forums
Help => Graphics => Topic started by: drew 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.
-
You could try something like:
char random = 'a' + sf::Randomizer::Random(0, 25);
For a random letter from 'a' to 'z'.
-
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.