Advertisement
Ahmed_Negm

Untitled

Nov 1st, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <bits/stdc++.h>
  3. using namespace sf;
  4. using namespace std;
  5.  
  6. int main(){
  7.      RenderWindow renderWindow(sf::VideoMode(800, 500), "SFML works!");
  8.         Event event;
  9.         Color color(Color::Red);
  10.         srand(time(NULL));
  11.         Texture texture;
  12.         if(!texture.loadFromFile("tmp/try.gif")){
  13.             cout<<"not found";
  14.             return 0;
  15.         }
  16.         Sprite sprite;
  17.         sprite.setTexture(texture);
  18.         sprite.setPosition(Vector2f(150,200));
  19.  
  20.  
  21.  
  22.         srand(time(NULL));
  23.         while(renderWindow.isOpen()){
  24.             while(renderWindow.pollEvent(event)){
  25.                 if(event.type == Event::Closed) renderWindow.close();
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.             }
  33.             renderWindow.clear(color);
  34.             renderWindow.draw(sprite);
  35.             renderWindow.display();
  36.  
  37.         }
  38.  
  39.    return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement