STANAANDREY

Manele-virus

Nov 16th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <stdlib.h>
  3. #define x 500
  4. #define y 400
  5.  
  6. sf::RenderWindow windows[300];
  7.  
  8. void delay(float t)
  9. {
  10.     sf::Clock clock;
  11.     sf::Time time = clock.getElapsedTime();
  12.     float aux = time.asSeconds();
  13.     while ((float)aux < (float)t)
  14.     {
  15.         time = clock.getElapsedTime();
  16.         aux = time.asSeconds();
  17.     }
  18. }
  19.  
  20. int main()
  21. {
  22.     sf::Texture texture;
  23.     if (!texture.loadFromFile("meme.jpg"))
  24.     {
  25.         return 0;
  26.     }
  27.     sf::Sprite sprite;
  28.     sprite.setTexture(texture);
  29.     for (int i = 0; i < 300; ++i)
  30.     {
  31.         windows[i].create(sf::VideoMode(x, y), "MOCANU-Virus");
  32.         windows[i].setPosition(sf::Vector2i(rand() % 400, rand() % 400));
  33.         windows[i].draw(sprite);
  34.         windows[i].display();
  35.         delay(0.4f);
  36.     }
  37.     return 0;
  38. }
Add Comment
Please, Sign In to add comment