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

Author Topic: sf::Clock  (Read 1085 times)

0 Members and 1 Guest are viewing this topic.

ico170

  • Newbie
  • *
  • Posts: 3
    • View Profile
sf::Clock
« on: May 06, 2013, 10:26:51 am »
hy i am trying to print the value of the sf::clock as text,can anybody help me with that because i cant convert it to string...

how to make the float in to a sf::string?

i am using sfml 2.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Clock
« Reply #1 on: May 06, 2013, 10:30:46 am »
Converting numbers to strings is a basic language feature, not something specific to SFML.

So: Google "C++ float to string" ;)
Laurent Gomila - SFML developer

ico170

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: sf::Clock
« Reply #2 on: May 06, 2013, 11:59:57 am »
i get the conversion but the clock doesnt want to print only text of current time but prints all the values beffore even if i put  string.clear();

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::Clock
« Reply #3 on: May 06, 2013, 12:05:57 pm »
Donc reuse the same stringstream. Either create a new one for every conversion, or call stringstream.str("") if you use the same instance.
Laurent Gomila - SFML developer

ico170

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: sf::Clock
« Reply #4 on: May 06, 2013, 12:31:33 pm »
that will work :) ty 

 

anything