Advertisement
STANAANDREY

kbd_sfml

Apr 11th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include<iostream>
  2. #include <string>
  3. #include"SFML\Graphics.hpp"
  4. #include"SFML\Window.hpp"
  5. #include"SFML\System.hpp"
  6. using namespace std;
  7. using namespace sf;
  8.  
  9.  
  10. int main()
  11. {
  12.     string s="sfml";
  13.  RenderWindow window(VideoMode(600,600),s);
  14.  window.setFramerateLimit(60);
  15.     while (window.isOpen())
  16.     {
  17.  
  18.         Event event;
  19.         while (window.pollEvent(event))
  20.         {
  21.             if (event.type == Event::Closed)
  22.                 window.close();
  23.  
  24.             if (event.KeyPressed && event.key.code == Keyboard::Escape)
  25.                 window.close();
  26.             switch (event.key.code)
  27.             {
  28.                 case Keyboard::C:
  29.                 cout<<"c";break;
  30.  
  31.             }
  32.             if (event.type==Event::KeyReleased)
  33.                 cout<<12345<<endl;
  34.         }
  35.  
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement