Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Write Number on the Screen
Print
Pages: [
1
]
Author
Topic: Write Number on the Screen (Read 3864 times)
0 Members and 1 Guest are viewing this topic.
Mikea
Newbie
Posts: 28
Write Number on the Screen
«
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.. ?
Logged
Check out my sfml games
here
Astrof
Full Member
Posts: 135
Write Number on the Screen
«
Reply #1 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/
Logged
dabo
Sr. Member
Posts: 260
Write Number on the Screen
«
Reply #2 on:
February 01, 2009, 10:31:17 pm »
http://www.sfml-dev.org/forum/viewtopic.php?t=116
Logged
Astrof
Full Member
Posts: 135
Write Number on the Screen
«
Reply #3 on:
February 01, 2009, 10:37:24 pm »
yes there you go, a link to another topic on this forum ^_^
Logged
Mikea
Newbie
Posts: 28
Write Number on the Screen
«
Reply #4 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
Logged
Check out my sfml games
here
Laurent
Administrator
Hero Member
Posts: 32498
Write Number on the Screen
«
Reply #5 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().
Logged
Laurent Gomila - SFML developer
Mikea
Newbie
Posts: 28
Write Number on the Screen
«
Reply #6 on:
February 02, 2009, 03:24:35 pm »
sweet THANKS
Logged
Check out my sfml games
here
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Write Number on the Screen
anything