Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #ifdef SFML_STATIC
  2. #pragma comment(lib, "glew.lib")
  3. #pragma comment(lib, "freetype.lib")
  4. #pragma comment(lib, "jpeg.lib")
  5. #pragma comment(lib, "opengl32.lib")
  6. #pragma comment(lib, "winmm.lib")
  7. #pragma comment(lib, "gdi32.lib")
  8. #endif // SFML_STATIC
  9.  
  10.  
  11. #include <SFML/Graphics.hpp>
  12. #include <SFML/Audio.hpp>
  13. #include <iostream>
  14.  
  15. int main()
  16. {
  17. sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
  18. sf::CircleShape shape(100.f);
  19. shape.setFillColor(sf::Color::Green);
  20.  
  21.  
  22. while (window.isOpen())
  23. {
  24. sf::SoundBuffer buffer;
  25. sf::Event event;
  26. sf::Sound sound;
  27. if (sound.getStatus() == 2){
  28. std::cout << "HOLY SHIT ITS PLAYING";
  29. }
  30. else if (sound.getStatus() == 0){
  31. std::cout << "0";
  32. }
  33.  
  34. while (window.pollEvent(event))
  35. {
  36. if (sf::Mouse::isButtonPressed(sf::Mouse::Left)){
  37. if (!buffer.loadFromFile("01.wav")){
  38. std::cout << "Failure";
  39. }
  40. sound.setBuffer(buffer);
  41. sound.play();
  42. //std::cout << "Playing sound";
  43. sound.setVolume(100);
  44. }
  45. if (event.type == sf::Event::Closed)
  46. window.close();
  47. }
  48.  
  49. window.clear();
  50. window.draw(shape);
  51. window.display();
  52. }
  53.  
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement