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

Author Topic: Text Box Input  (Read 10993 times)

0 Members and 1 Guest are viewing this topic.

Gio

  • Newbie
  • *
  • Posts: 16
    • View Profile
Text Box Input
« on: June 14, 2010, 02:01:50 am »
Hi, I want to know if there is a way to get text input in a manner similar to std::cin on a SFML window, in that there is a white box and as the player enters letters of a string, it shows them as they type, and when the player hits enter or another key it is saved as a string (either std, c-style or sf) for use later. I know how to do this with integration, but I would like to do it with raw SFML. Thanks!
~~Gio~~

kitchen

  • Newbie
  • *
  • Posts: 14
    • View Profile
Text Box Input
« Reply #1 on: June 14, 2010, 02:58:16 am »
You will probably have to code your own (or find an open source SFML compatible) GUI system.

Here is one that I found with a quick search.

WSPSNIPER

  • Newbie
  • *
  • Posts: 28
    • View Profile
yes
« Reply #2 on: June 19, 2010, 03:46:09 am »
you can type it in using
(char)event.Text.Uincode and adding it to a std::string  // sf::String::SetText(std_string + _char);

std::cout << _text.GetText(); // it will print the entered text


just giving you a map, it is simple you use event.Text.Uincode to get the typed char and typecast it to a char so you can add it to the current string in the set text function the use the get text function to get the data

 

anything