SFML community forums
Help => Graphics => Topic started by: Heero on October 19, 2007, 01:24:06 pm
-
Is it possible to display a value in a window?
I want you display the mouse position in a window, but String can only handle std::strings.
Must I convert my float value to string to be able to display the text?
Heero
*Solved*
It now works, i use this code to display a value in the window.
_itoa(Sprite.GetRotation(), buffer, 10);
String.SetText(buffer);
-
A better way in C++ is to use stringstreams :
#include <sstream>
std::ostringstream oss;
oss << Sprite.GetRotation();
String.SetText(oss.str());
-
Thanks Laurent, thats looks much better :)