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__
|
#define __PTF_ENGINE_HPP__
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
#include <SFML/Audio.hpp>
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
#include "engine_state.hpp"
|
#include "engine_state.hpp"
|
||||||
#include "resource_manager.hpp"
|
#include "resource_manager.hpp"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* La classe principale Engine coordonne les éléments
|
* La classe principale Engine coordonne les éléments
|
||||||
* du jeu et organise le dessin des frames
|
* du jeu et organise le dessin des frames
|
||||||
|
@ -15,6 +17,7 @@ private:
|
||||||
sf::Clock clock;
|
sf::Clock clock;
|
||||||
sf::RenderWindow window;
|
sf::RenderWindow window;
|
||||||
sf::View view;
|
sf::View view;
|
||||||
|
sf::Music music;
|
||||||
|
|
||||||
EngineState state;
|
EngineState state;
|
||||||
ResourceManager resources;
|
ResourceManager resources;
|
||||||
|
|
Binary file not shown.
|
@ -16,6 +16,13 @@ Engine::Engine() : window(
|
||||||
|
|
||||||
void Engine::start() {
|
void Engine::start() {
|
||||||
float accumulator = 0;
|
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
|
// boucle d'événements sur la fenêtre
|
||||||
while (window.isOpen()) {
|
while (window.isOpen()) {
|
||||||
|
|
Loading…
Reference in New Issue