Shift+Number key produces a key code of '0' instead of the correct one #187

Closed
SoleSoul opened this Issue Mar 23, 2012 · 4 comments

Projects

None yet

2 participants

@SoleSoul

On Archlinux SFML version 1.99.git20120312-1
When catching an event of a number key press, for example Num1, while shift is held down, both

event.key.code == sf::Keyboard::Num1

and

sf::Keyboard::isKeyPressed(sf::Keyboard::Num1)

return false.
If I print the event.key.code, the code is '0' for all of the numbers just as the code for ';' and 'A'. The shift press itself correctly reports the code 38.

while (window.isOpen())
{
    window.waitEvent(event);
    if(event.type == sf::Event::KeyPressed)
        std::cout<<event.key.code<<endl;
}
@LaurentGomila
Simple and Fast Multimedia Library member

See #7

@SoleSoul

Thank you.
Is there a temporary workaround for catching a shift+number event?

@LaurentGomila
Simple and Fast Multimedia Library member

You can catch sf::TextEntered events and watch numbers, but that won't be perfect (ie. any input method producing a number will trigger your code).

@SoleSoul

I'll try that.
Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment