#include <SFML/Window.hpp>
#include <iostream>
int main()
{
sf::Window window(sf::VideoMode(800, 600), "My window");
window.setKeyRepeatEnabled(false);
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
switch(event.type)
{
case sf::Event::KeyPressed:
{
if(event.key.code == sf::Keyboard::W)
{
std::cout << "\n\nKeyPressed";
}
}
case sf::Event::KeyReleased:
{
if(event.key.code == sf::Keyboard::W)
{
//window.close();
//break;
std::cout << "\nKeyReleased";
}
}
}
}
}
return 0;
}