full map not needed anymore

This commit is contained in:
Askou
2021-06-09 09:53:28 +02:00
parent 07f61fb462
commit ff7d9d411b
3 changed files with 14 additions and 19 deletions
+4 -4
View File
@@ -7,16 +7,15 @@
namespace BBM
{
float MusicComponent::volume = 0.75;
MusicComponent::MusicComponent(WAL::Entity &entity, const std::string &musicPath)
: WAL::Component(entity),
_musicPath(musicPath),
_music(RAY::Audio::Music(musicPath))
{
this->volume = 1;
}
float MusicComponent::volume;
WAL::Component *MusicComponent::clone(WAL::Entity &entity) const
{
return new MusicComponent(entity, this->_musicPath);
@@ -43,7 +42,8 @@ namespace BBM
void MusicComponent::setVolume(float &volumeUpdate)
{
if (volumeUpdate >= 0) {
this->_music.setVolume(volume);
this->volume = volumeUpdate;
this->_music.setVolume(this->volume);
}
}
+9 -10
View File
@@ -7,26 +7,25 @@
#include "SoundComponent.hpp"
namespace BBM
{
{
float SoundComponent::volume = 0.75;
SoundComponent::SoundComponent(WAL::Entity &entity, \
const std::map<SoundComponent::soundIndex, std::string> &soundPath)
: WAL::Component(entity),
_soundIndex(IDLE),
_soundPath(soundPath)
{
this->volume = 1;
for (int i = 0; i <= DEATH; i++) {
if (soundPath.at(static_cast<soundIndex>(i)).empty()) {
this->_isLoad[static_cast<soundIndex>(i)] = false;
} else {
this->_isLoad[static_cast<soundIndex>(i)] = true;
this->_soundList[static_cast<soundIndex>(i)] = std::make_unique<RAY::Audio::Sound>(soundPath.at(static_cast<soundIndex>(i)));
}
this->_isLoad[static_cast<soundIndex>(i)] = false;
}
for (auto &soundPath : soundPath)
{
this->_isLoad[soundPath.first] = true;
this->_soundList[soundPath.first] = std::make_unique<RAY::Audio::Sound>(soundPath.second);
}
}
float SoundComponent::volume;
WAL::Component *SoundComponent::clone(WAL::Entity &entity) const
{
return new SoundComponent(entity, this->_soundPath);
+1 -5
View File
@@ -67,7 +67,7 @@ namespace BBM
void enableRaylib(WAL::Wal &wal)
{
//RAY::TraceLog::setLevel(LOG_WARNING);
RAY::TraceLog::setLevel(LOG_WARNING);
RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE);
wal.addSystem<AnimationsSystem>()
.addSystem<AnimatorSystem>()
@@ -78,12 +78,8 @@ namespace BBM
{
auto scene = std::make_shared<WAL::Scene>();
std::map<SoundComponent::soundIndex, std::string> soundPath= {
{SoundComponent::IDLE, ""},
{SoundComponent::JUMP, "assets/sounds/jump.wav"},
{SoundComponent::BOMB, "assets/sounds/bomb_drop.ogg"},
{SoundComponent::MOVE, "assets/sounds/jump.wav"},
{SoundComponent::HURT, ""},
{SoundComponent::THROW, ""},
{SoundComponent::DEATH, "assets/sounds/death.ogg"}
};
scene->addEntity("player")