So I am writing a tetris and I am about done, last thing missing is a textbox for the player to type in his or her name.
I've read writing a general purpose textbox can be hell, I am thinking about using a library, though I am not sure which one to pick, don't want to blow things out of proportion.
I want to keep things as simple as possible, any ideas about what would be the simplest/quickest solution?
It's being developed in c++ with openGL and SFML. I am trying to keep things portable though I am willing to make sacrifices.
Any info is much appreciated.
A simple textbox
If you just want to read a string of text, it might be simpler to read the characters directly using events.
Each time you detect a keypress that's a character, you append the character to a string. When you detect that Enter was pressed (or something similar), you know you've read the full name.
A google search for "sfml gui" also gave this, which might be useful to you.
Each time you detect a keypress that's a character, you append the character to a string. When you detect that Enter was pressed (or something similar), you know you've read the full name.
A google search for "sfml gui" also gave this, which might be useful to you.
Thanks for the reply.
One feature I would like the text box to have is being able to delete text, guess this can be accomplished manually with SFML's Key Pressed too though.
One feature I would like the text box to have is being able to delete text, guess this can be accomplished manually with SFML's Key Pressed too though.
You can detect that a backspace is being pressed, and then remove the last character from the string.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement