A simple textbox

Started by
3 comments, last by Antonym 13 years, 9 months ago
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.
Advertisement
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.
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.
You can detect that a backspace is being pressed, and then remove the last character from the string.
Yeah that's what I meant.

For future reference, what would be a good option if I wanted a fully functional text box?

Edit: Just noticed that it gets buggy if I click non-character keys :S.

Thanks.

This topic is closed to new replies.

Advertisement