Ajout de la musique (à modifier pour charger depuis le RessourceManager)
This commit is contained in:
parent
b527c9b587
commit
377992d718
|
@ -2,10 +2,12 @@
|
|||
#define __PTF_ENGINE_HPP__
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Audio.hpp>
|
||||
#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;
|
||||
|
|
Binary file not shown.
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue