Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SFMLAudioTest.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <SFML/Graphics.hpp>
- #include <SFML/Audio.hpp>
- int _tmain(int argc, _TCHAR* argv[])
- {
- sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
- sf::CircleShape shape(100.f);
- shape.setFillColor(sf::Color::Green);
- sf::Sound sound = sf::Sound();
- sf::SoundBuffer buffer = sf::SoundBuffer();
- if(!buffer.loadFromFile("F:\\Soundboard\\Borderlands2\\Gaige\\TidalWaveUgly.wav"))
- return -1;
- sound.setBuffer(buffer);
- while (window.isOpen())
- {
- sf::Event event;
- while (window.pollEvent(event))
- {
- if (event.type == sf::Event::Closed)
- window.close();
- if (event.type == sf::Event::MouseButtonReleased)
- {
- shape.setFillColor(sf::Color::Red);
- sound.play();
- }
- }
- window.clear();
- window.draw(shape);
- window.display();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement