diff --git a/src/Components/Listener.h b/src/Components/Listener.h new file mode 100644 index 0000000..3ca53d0 --- /dev/null +++ b/src/Components/Listener.h @@ -0,0 +1,19 @@ +#ifndef Components_Listener_h__ +#define Components_Listener_h__ + +#include +#include +#include "Component.h" + +namespace Components +{ + + struct Listener : Component + { + Listener() {} + + virtual Listener* Clone() const override { return new Listener(*this); } + }; + +} +#endif // !Components_Listener_h__ \ No newline at end of file diff --git a/src/Systems/SoundSystem.cpp b/src/Systems/SoundSystem.cpp index cbf31bb..1a17f43 100755 --- a/src/Systems/SoundSystem.cpp +++ b/src/Systems/SoundSystem.cpp @@ -6,12 +6,15 @@ void Systems::SoundSystem::Initialize() { FMOD_RESULT result; result = FMOD::System_Create(&m_FmodSystem); - result = m_FmodSystem->init(32, FMOD_INIT_NORMAL, 0); + FMOD::Sound *sound; FMOD::Channel *channel; - + FMOD_VECTOR pos; + pos.x = 0.f; + pos.y = 0.f; + pos.z = 0.f; m_FmodSystem->createSound("Sounds/WUB.mp3", FMOD_HARDWARE, 0, &sound); m_FmodSystem->playSound(FMOD_CHANNEL_FREE, sound, false, 0); } @@ -19,6 +22,7 @@ void Systems::SoundSystem::Initialize() void Systems::SoundSystem::RegisterComponents(ComponentFactory* cf) { cf->Register([]() { return new Components::SoundEmitter(); }); + cf->Register([]() { return new Components::Listener(); }); } void Systems::SoundSystem::RegisterResourceTypes(ResourceManager* rm) @@ -30,3 +34,12 @@ void Systems::SoundSystem::Update(double dt) { m_FmodSystem->update(); } + +void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +{ + auto listener = m_World->GetComponent(entity); + if(listener) + { + + } +} diff --git a/src/Systems/SoundSystem.h b/src/Systems/SoundSystem.h index 7ac24a7..ba7ce9d 100755 --- a/src/Systems/SoundSystem.h +++ b/src/Systems/SoundSystem.h @@ -7,6 +7,7 @@ #include "System.h" #include "Components/Transform.h" #include "Components/SoundEmitter.h" +#include "Components/Listener.h" #include "Events/PlaySound.h" #include "Sound.h" @@ -23,6 +24,8 @@ public: void RegisterResourceTypes(ResourceManager* rm) override; void Initialize() override; void Update(double dt) override; + void UpdateEntity(double dt, EntityID entity, EntityID parent) override; + //void OnComponentCreated(std::string type, std::shared_ptr component) override; FMOD::System *m_FmodSystem; diff --git a/vs11/Returngeance/Returngeance.vcxproj b/vs11/Returngeance/Returngeance.vcxproj index a7c4e37..fe94757 100755 --- a/vs11/Returngeance/Returngeance.vcxproj +++ b/vs11/Returngeance/Returngeance.vcxproj @@ -133,6 +133,7 @@ + diff --git a/vs11/Returngeance/Returngeance.vcxproj.filters b/vs11/Returngeance/Returngeance.vcxproj.filters index 49cc263..c2e8f40 100755 --- a/vs11/Returngeance/Returngeance.vcxproj.filters +++ b/vs11/Returngeance/Returngeance.vcxproj.filters @@ -356,6 +356,9 @@ Input\Events + + Audio\Components +