diff --git a/include/engine.hpp b/include/engine.hpp index b883ca8..2ae6f45 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -2,10 +2,12 @@ #define __PTF_ENGINE_HPP__ #include +#include #include "object.hpp" #include "engine_state.hpp" #include "resource_manager.hpp" + /** * La classe principale Engine coordonne les éléments * du jeu et organise le dessin des frames @@ -15,6 +17,7 @@ private: sf::Clock clock; sf::RenderWindow window; sf::View view; + sf::Music music; EngineState state; ResourceManager resources; diff --git a/res/music_lvl1.wav b/res/music_lvl1.wav new file mode 100644 index 0000000..2e49972 Binary files /dev/null and b/res/music_lvl1.wav differ diff --git a/src/engine.cpp b/src/engine.cpp index dae2997..5f2b181 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -16,6 +16,13 @@ Engine::Engine() : window( void Engine::start() { float accumulator = 0; + if (!music.openFromFile("./res/music_lvl1.wav")) + { + // erreur + } + music.play(); + music.setVolume(15); + music.setLoop(true); // boucle d'événements sur la fenêtre while (window.isOpen()) {