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

Author Topic: Inputing Text to SFML  (Read 3028 times)

0 Members and 1 Guest are viewing this topic.

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
Inputing Text to SFML
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Inputing Text to SFML
« Reply #1 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 ;)
Laurent Gomila - SFML developer

Beta_Ravener

  • Jr. Member
  • **
  • Posts: 51
    • ICQ Messenger - 271426715
    • View Profile
Inputing Text to SFML
« Reply #2 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 :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Inputing Text to SFML
« Reply #3 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.
Laurent Gomila - SFML developer

 

anything