So I made this little textbox here, and when I press backspace it should delete the last character. But it only happens once, like if I press it again nothing happens. The text stays the same.
Here is the code:
while(newstagewnd.GetEvent(event))
{
if(event.Type == sf::Event::KeyPressed and event.Key.Code == sf::Key::Back)
{
if(titlein.value.size()>0)
{
titlein.value.resize(titlein.value.size()-1);
}
}
if(event.Type == sf::Event::TextEntered)
{
if(event.Text.Unicode < 256)
{
titlein.addinput(static_cast<char>(event.Text.Unicode));
}
}
if(event.Type == sf::Event::Closed)
{
newstagewnd.Close();
}
}
Any help on this?