AllenYuan

tiles

May 24th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <time.h>
  3. using namespace sf;
  4.  
  5. int main()
  6. {
  7.   RenderWindow window(VideoMode(320, 480), "The Game!"); // window config
  8.  
  9.   Texture t;
  10.   t.loadFromFile("/Users/alleyuan/code-snippets/16_games/01 Tetris/images/tiles.png");
  11.  
  12.   Sprite s(t);
  13.  
  14.   while (window.isOpen()) // game loop
  15.   {
  16.     Event e;
  17.     while (window.pollEvent(e)) // close window
  18.     {
  19.       if (e.type == Event::Closed)
  20.         window.close();
  21.     }
  22.  
  23.     window.clear(Color::White);
  24.     window.draw(s);
  25.     window.display();
  26.   }
  27.  
  28.   return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment