SFML community forums
Help => General => Topic started by: Gio on June 14, 2010, 02:01:50 am
-
Hi, I want to know if there is a way to get text input in a manner similar to std::cin on a SFML window, in that there is a white box and as the player enters letters of a string, it shows them as they type, and when the player hits enter or another key it is saved as a string (either std, c-style or sf) for use later. I know how to do this with integration, but I would like to do it with raw SFML. Thanks!
-
You will probably have to code your own (or find an open source SFML compatible) GUI system.
Here (http://gitorious.org/sfgui) is one that I found with a quick search.
-
you can type it in using
(char)event.Text.Uincode and adding it to a std::string // sf::String::SetText(std_string + _char);
std::cout << _text.GetText(); // it will print the entered text
just giving you a map, it is simple you use event.Text.Uincode to get the typed char and typecast it to a char so you can add it to the current string in the set text function the use the get text function to get the data