add basic music manager

This commit is contained in:
Askou
2021-06-07 11:22:45 +02:00
parent 9dbb1d6d6d
commit e04c8d0bd4
9 changed files with 161 additions and 33 deletions
+32 -13
View File
@@ -1,28 +1,34 @@
//
// Created by Zoe Roux on 5/17/21.
// Created by Tom Augier on 05/06/2021
//
#pragma once
#include "Models/Vector3.hpp"
#include "Component/Component.hpp"
#include "Music.hpp"
#include <map>
#include "Audio/Music.hpp"
namespace BBM
{
//! @brief A basic Music component
class MusicComponent : public WAL::Component
{
private:
//! @brief music of this entity
RAY::Audio::Music _music;
//! @brief path to the music
std::string _musicPath;
//! @brief Create a new MusicComponent linked to a specific entity
explicit MusicComponent(WAL::Entity &entity);
public:
enum musicIndex {
IDLE,
JUMP,
BOMB,
MOVE,
HURT,
THROW,
DEATH,
};
void setIndex(musicIndex index);
musicIndex getIndex();
//! @brief load music
void loadMusic();
@@ -41,15 +47,28 @@ namespace BBM
//! @brief is music playing
bool isPlaying(void);
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief Create a new MusicComponent at a certain Music
MusicComponent(WAL::Entity &entity, std::string &musicPath);
MusicComponent(WAL::Entity &entity, std::map<musicIndex, std::string> &musicPath);
//! @brief A Music component is copy constructable
MusicComponent(const MusicComponent &) = default;
//! @brief A default destructor
~MusicComponent() override = default;
//! @brief A Music component is not assignable
MusicComponent &operator=(const MusicComponent &) = delete;
private:
//! @brief music of this entity
std::map<musicIndex, RAY::Audio::Music> _musicList;
std::map<musicIndex, bool> _isLoad;
//! musicIndex
musicIndex _musicIndex;
//! @brief Create a new MusicComponent linked to a specific entity
explicit MusicComponent(WAL::Entity &entity);
};
} // namespace WAL
} // namespace BBM