SFML community forums

Help => Window => Topic started by: Beta_Ravener on July 25, 2010, 12:25:35 am

Title: Inputing Text to SFML
Post by: Beta_Ravener on July 25, 2010, 12:25:35 am
Before I write my code for receiving text from user through Event.Key.Code, and I will end with solution supporting only ANSII, is there way to capture text as I would write to text editor (Actually funny I swapped GLUT for SFML because it couldn't handle Key Codes, but now I need thing that GLUT does provide as only input). I mean I don't want to receive shift+a, but A, or shift+3 = #. I hope there is some way to doo it, I saw sf::String, but can't find what I'm looking for. If there is this solution it would be good idea to give it to tutorial.
Title: Inputing Text to SFML
Post by: Laurent on July 25, 2010, 10:09:10 am
sf::Event::TextEntered is what you need. There are tons of topics about that on this forum ;)
Title: Inputing Text to SFML
Post by: Beta_Ravener on July 25, 2010, 04:43:51 pm
Ok I got working. I would just like to ask how SFML recognize what is text. Because keys like F1, home, delete are not recognized (which is good), but it recognized backspace as UNICODE char 8. I think that number it has also in ANSII, but shouldn't be treated backspace way like delete? I'm just asking it's nice class for input though (way better then in GLUT). I think that's only one key maybe two with TAB so handling it won't be a problem :)
Title: Inputing Text to SFML
Post by: Laurent on July 25, 2010, 07:19:54 pm
SFML doesn't decide, it's up to the OS. I think that anything which is defined in the unicode standard is considered a valid character for input, and tab/backspace are part of it.