SFML community forums

Help => Graphics => Topic started by: Mikea on February 01, 2009, 09:59:19 pm

Title: Write Number on the Screen
Post by: Mikea on February 01, 2009, 09:59:19 pm
I'd like to write numbers on screen, like time and/or scores. How can I do that if sf::String only allows text.. ?
Title: Write Number on the Screen
Post by: Astrof on February 01, 2009, 10:18:26 pm
use a string output stream?
that would be my guess.

EDIT: Check this out: http://www.fredosaurus.com/notes-cpp/strings/stringstream.html
http://notfaq.wordpress.com/2006/08/30/c-convert-int-to-string/
Title: Write Number on the Screen
Post by: dabo on February 01, 2009, 10:31:17 pm
http://www.sfml-dev.org/forum/viewtopic.php?t=116
Title: Write Number on the Screen
Post by: Astrof on February 01, 2009, 10:37:24 pm
yes there you go, a link to another topic on this forum ^_^
Title: Write Number on the Screen
Post by: Mikea on February 02, 2009, 01:06:39 pm
thank you :) although to update time this method only appends the text. I tryied to flush the stream but it keeps appending the numbers... example:

Score 1

Update

Score 12 instead of Score 2
Title: Write Number on the Screen
Post by: Laurent on February 02, 2009, 02:08:11 pm
Tu remove the contents of a stringstream you have to call its str("") function, not clear() or flush().
Title: Write Number on the Screen
Post by: Mikea on February 02, 2009, 03:24:35 pm
sweet THANKS :D