Advertisement
gorgoroth666

SFML2 - 02 - normal window - poll all events in game loop

Jul 10th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #ifdef _MSC_VER  
  2.     #ifdef _WIN32
  3.         #pragma comment( lib, "sfml-system.lib" )      
  4.         #pragma comment( lib, "sfml-graphics.lib" )        
  5.         #pragma comment( lib, "sfml-window.lib" )  
  6.     #endif
  7. #endif
  8.  
  9. #include <SFML\System.hpp>
  10. #include <SFML\Graphics.hpp>
  11.  
  12. using namespace sf;
  13.  
  14. int main()
  15. {
  16.     VideoMode videoMode(800,600,32);
  17.     RenderWindow renderWindow(videoMode,"Empty Window");
  18.    
  19.     while (renderWindow.isOpen())
  20.         {
  21.             renderWindow.clear(Color(0, 0, 255));
  22.             renderWindow.display();
  23.        
  24.             Event event;
  25.         while (renderWindow.pollEvent(event))
  26.             {
  27.             if (event.type == Event::Closed)
  28.                         renderWindow.close();
  29.             }
  30.  
  31.     }
  32.  
  33.     return EXIT_SUCCESS;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement