Skip to content

Instantly share code, notes, and snippets.

@eXpl0it3r
Created May 10, 2018 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eXpl0it3r/99547fc2e005b711673abea814716872 to your computer and use it in GitHub Desktop.
Save eXpl0it3r/99547fc2e005b711673abea814716872 to your computer and use it in GitHub Desktop.
Example Input Test
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(1280, 720), "Minimal, complete and verifiable example");
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::KeyPressed)
std::cout << "KeyPressed: " << event.key.code << "\n";
else if (event.type == sf::Event::KeyReleased)
std::cout << "KeyReleased: " << event.key.code << "\n";
}
window.clear();
window.display();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment