Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <bits/stdc++.h>
- using namespace sf;
- using namespace std;
- int main(){
- RenderWindow renderWindow(sf::VideoMode(800, 500), "SFML works!");
- Event event;
- Color color(Color::Red);
- srand(time(NULL));
- Texture texture;
- if(!texture.loadFromFile("tmp/try.gif")){
- cout<<"not found";
- return 0;
- }
- Sprite sprite;
- sprite.setTexture(texture);
- sprite.setPosition(Vector2f(150,200));
- srand(time(NULL));
- while(renderWindow.isOpen()){
- while(renderWindow.pollEvent(event)){
- if(event.type == Event::Closed) renderWindow.close();
- }
- renderWindow.clear(color);
- renderWindow.draw(sprite);
- renderWindow.display();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement