#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "States of Key Modifiers");
sf::Font font;
if (!font.loadFromFile("arial.ttf"))
return EXIT_FAILURE;
sf::Text text;
text.setFont(font);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
text.setString(
"Left Shift: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) + "\n" +
"Left Control: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::LControl)) + "\n" +
"Left Alt: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt)) + "\n" +
"Right Shift: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::RShift)) + "\n" +
"Right Control: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::RControl)) + "\n" +
"Right Alt: " + std::to_string(sf::Keyboard::isKeyPressed(sf::Keyboard::RAlt))
);
window.clear();
window.draw(text);
window.display();
}
return EXIT_SUCCESS;
}