SFML community forums
Help => Window => Topic started by: arcticstrat on March 05, 2010, 03:53:17 pm
-
I'm creating a highscores option for my game. When the game finishes, the player can enter their name. How can I get the text they enter in the App window and display it for them to see?
-
sf::Event::TextEntered for input, and sf::String for output.
-
Could you please show me in code how I'd do this because I'm getting an error that it can't convert sf::Event::EventType to sf::Unicode::Text
-
std::string str;
sf::String text;
// In event loop...
if (event.Type == sf::Event::TextEntered)
{
// Handle ASCII characters only
if (event.Text.Unicode < 128)
{
str += static_cast<char>(event.Text.Unicode);
text.SetText(str);
}
}
// In main loop...
window.Draw(text);
-
Thanks! Got it working now
-
Hi I am making similar application in which I have a puzzle game where if you get high score than number of options start decreasing as it's an IQ testing game. But I am not understand how to put stop condition in loop. Because I have tried different conditions but each time either loop break forcefully or went into the infinite loop. Can you guide me what should be the loop condition??
-
I'm sure that if you could post a source code, all of this will be easier to understand for all of us ;)