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

Author Topic: Text Input  (Read 2288 times)

0 Members and 1 Guest are viewing this topic.

kadmio

  • Newbie
  • *
  • Posts: 2
    • View Profile
Text Input
« on: December 27, 2010, 02:52:21 pm »
Hi all.

I am working on a project for my university called GraphC ( http://code.google.com/p/graphc/ ) which is wrapper interface of SFML for first year programming students. The final project of the subject usually consists of a program that has to load some file and display something on screen based on it. Up to now we have used QuickCG, but it has proven to be ineffective and unfriendly to the students, so I am writing something simpler for them to use.

The specific feature I need is related to text input. What I would need is a function that is able to process a keyevent and return the corresponding character of the key pressed, but not only the bunch from the keycode structure. but all the ones available on the keyboard, as if it was the console. This would also allow some more complex text features to be implemented that I think also other might find useful.

The workaround I am using now limits me only to the characters from the keycode structure, it would be great if that limit wasn't there.

Regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Text Input
« Reply #1 on: December 27, 2010, 03:05:49 pm »
Look at sf::Event::TextEntered, this is exactly what you need. KeyPressed should never be used for text input.
Laurent Gomila - SFML developer

kadmio

  • Newbie
  • *
  • Posts: 2
    • View Profile
Text Input
« Reply #2 on: December 27, 2010, 03:10:04 pm »
Thanks a lot, I hadn't found it on the documentation.