SFML community forums
Help => General => Topic started by: symtaxiz on January 06, 2014, 02:15:36 pm
-
Hi people of this community :),
Can you please tell me if it is possible to print an int in a text? Because as I know it is only possible to print a string (sf::String). I want to do this because I'd like to show how much points the player have in a very simple game.
Thank you for the attention.
-
"print" is probably not the best description, but I assume you want to draw an sf::Text and use an integer as value.
If you have a C++11 compatible compiler, you can use std::to_string otherwise, you can use a std::stringstream. The conversion between std::string and sf::String can then happen rather easily.
If you still don't get how to do it, I suggest you google "int to string c++" and you'll find tons of solutions. ;)
-
Thank you!!! ;D
I have solved it.