add updateMusicStream + musicSystem

This commit is contained in:
Askou
2021-06-08 14:52:03 +02:00
parent 856eb1adc2
commit 6c7d8fcfcf
12 changed files with 198 additions and 112 deletions
+24
View File
@@ -0,0 +1,24 @@
//
// Created by Tom Augier on 05/06/2021
//
#include "MusicSystem.hpp"
#include <map>
namespace BBM {
MusicSystem::MusicSystem(WAL::Wal &wal)
: System(wal)
{}
void MusicSystem::onFixedUpdate(WAL::ViewEntity<MusicComponent> &entity)
{
auto &music = entity.get<MusicComponent>();
music.setVolume(music.volume);
if (!music.isPlaying())
music.playMusic();
music.updateMusicStream();
}
}
+31
View File
@@ -0,0 +1,31 @@
//
// Created by Tom Augier on 05/06/2021
//
#pragma once
#include "System/System.hpp"
#include "Window.hpp"
#include "Component/Music/MusicComponent.hpp"
#include "Component/Health/HealthComponent.hpp"
#include <Component/Controllable/ControllableComponent.hpp>
#include "Wal.hpp"
namespace BBM
{
class MusicSystem : public WAL::System<MusicComponent>
{
public:
//! @inherit
void onFixedUpdate(WAL::ViewEntity<MusicComponent> &entity) override;
//! @brief ctor
MusicSystem(WAL::Wal &wal);
//! @brief Default copy ctor
MusicSystem(const MusicSystem &) = default;
//! @brief Default dtor
~MusicSystem() override = default;
//! @brief A SoundManager screen system can't be assigned.
MusicSystem &operator=(const MusicSystem &) = delete;
};
}