Are you using a special keyboard layout?
So the following example application doesn't work?
#include <SFML/Graphics.hpp>
int main()
{
auto window = sf::RenderWindow{ { 1920u, 1080u }, "Color Switcher" };
window.setFramerateLimit(144);
auto backgroundColor = sf::Color::Black;
while (window.isOpen())
{
for (auto event = sf::Event{}; window.pollEvent(event);)
{
if (event.type == sf::Event::Closed)
{
window.close();
}
else if (event.type == sf::Event::KeyPressed && event.code == sf::Keyboard::R)
{
backgroundColor = sf::Color::Red;
}
else if (event.type == sf::Event::KeyRelease && event.code == sf::Keyboard::G)
{
backgroundColor = sf::Color::Green;
}
}
window.clear(backgroundColor);
window.display();
}
}
If you use SFML 2.6, can you try scancodes instead?