Jump to content
  • Advertisement
Sign in to follow this  
Antonym

A simple textbox

This topic is 3081 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
You can detect that a backspace is being pressed, and then remove the last character from the string.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!