Guest User

Untitled

a guest
Jul 12th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <SFML/Audio.hpp>
  2. #include <SFML/Graphics.hpp>
  3.  
  4. int main()
  5. {
  6.     sf::RenderWindow window(sf::VideoMode(640, 480), "Gamecoding Tutorials - Test Compile");
  7.  
  8.     sf::Texture texture;
  9.     if (!texture.loadFromFile("gfx/gc_tuts.png"))
  10.         return EXIT_FAILURE;
  11.  
  12.     sf::Sprite sprite(texture);
  13.  
  14.     sf::Font font;
  15.     if (!font.loadFromFile("font/coders_crux.ttf"))
  16.         return EXIT_FAILURE;
  17.  
  18.     sf::Text text("Gamecoding Tutorials!", font, 50);
  19.  
  20.     sf::Music music;
  21.     if (!music.openFromFile("sfx/funk.wav"))
  22.         return EXIT_FAILURE;
  23.  
  24.     music.setLoop(true);
  25.  
  26.     music.play();
  27.  
  28.     while (window.isOpen())
  29.     {
  30.         sf::Event event;
  31.         while (window.pollEvent(event))
  32.         {
  33.             if (event.type == sf::Event::Closed)
  34.                 window.close();
  35.         }
  36.  
  37.         window.clear(sf::Color(60, 60, 60));
  38.  
  39.         window.draw(sprite);
  40.  
  41.         window.draw(text);
  42.  
  43.         window.display();
  44.     }
  45.  
  46.     return EXIT_SUCCESS;
  47. }
Add Comment
Please, Sign In to add comment