Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Window
»
String keyboard input
Print
Pages: [
1
]
Author
Topic: String keyboard input (Read 3306 times)
0 Members and 2 Guests are viewing this topic.
Stupebrett
Newbie
Posts: 15
String keyboard input
«
on:
April 22, 2011, 06:51:43 pm »
Is there a way to input a string from the keyboard from a window, for example; "hello", like 'cin' in the standard library?
Logged
Laurent
Administrator
Hero Member
Posts: 32498
String keyboard input
«
Reply #1 on:
April 22, 2011, 07:24:16 pm »
You can use the sf::TextEntered event.
Logged
Laurent Gomila - SFML developer
Stupebrett
Newbie
Posts: 15
String keyboard input
«
Reply #2 on:
April 22, 2011, 09:02:46 pm »
Thanks! Is there a way to directly assign a varible through keyboard input?
Logged
Laurent
Administrator
Hero Member
Posts: 32498
String keyboard input
«
Reply #3 on:
April 22, 2011, 09:05:21 pm »
What do you mean?
Logged
Laurent Gomila - SFML developer
Stupebrett
Newbie
Posts: 15
String keyboard input
«
Reply #4 on:
April 22, 2011, 09:44:12 pm »
Like:
Code:
[Select]
int number;
cin >> number;
Logged
Laurent
Administrator
Hero Member
Posts: 32498
String keyboard input
«
Reply #5 on:
April 22, 2011, 10:34:06 pm »
No, the TextEntered event will only give you the characters that are typed (one by one), then it's up to you to store/convert them.
Logged
Laurent Gomila - SFML developer
Print
Pages: [
1
]
SFML community forums
»
Help
»
Window
»
String keyboard input