Hi,
I'm wanting to read in single key presses, do some error / special key checking and add the valid key presses to a c++ string. The string would be a mixture of upper and lower case letters and other symbols. Is there a simple way to do this rather than me having to check explicitly for every unique key like so?
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::L)) myString = myString+"L"
I've looked in the documentation but it wasn't obvious to me how to do this.
In SDL I've been able to do the following in the past:
if ( event.type == SDL_KEYDOWN )
{
if (( event.key.keysym.unicode < 0x80 ) &&
( event.key.keysym.unicode > 0 )) // it's printable
{
keyString = (char)event.key.keysym.unicode, 1;
I also noticed that only there only seem to be lower case letters defined currently. Does this mean I can't differentiate between upper and lower case input?
Thanks.