mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 18:31:17 +00:00
add updateMusicStream + musicSystem
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user