It seems like the realtime input and the event system handle things different for some reason, at least I get different results...
(Tested on Debian Sid)
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Test");
window.setFramerateLimit(60);
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
else if(event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Tilde)
std::cout << "Event" << std::endl;
else if(event.type == sf::Event::TextEntered && event.text.unicode < 128)
std::cout << "Text: " << static_cast<char>(event.text.unicode) << std::endl;
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Tilde))
std::cout << "Input" << std::endl;
window.clear();
window.display();
}
}
I have a Swiss (German) keyboard layout:
When I press the key left of the backspace, only the input gets triggered. If I press Shift+the key in question, I get both triggered. The TextEntered on the other hand works fine and shows exactly the symbols of the keys I press.
The actual ~ symbol only shows up, when pressing [Alt Gr]+ the key in question, which triggers the input, but no event.
So I guess we could throw that into
issue #7...
Note: If I apply the given patch, the tiled key won't be recognized on my system, neither by realtime input nor the event system.
Edit: The patch with both works again, but I don't think it's the way SFML will go, not even for a 'in the meantime' fix.