WIP
This commit is contained in:
+11
-9
@@ -391,6 +391,8 @@ public:
|
|||||||
|
|
||||||
// I apologize about this.
|
// I apologize about this.
|
||||||
ScreenShakeUpdate(dt);
|
ScreenShakeUpdate(dt);
|
||||||
|
} else {
|
||||||
|
m_EventBroker->Process<Systems::SoundSystem>();
|
||||||
}
|
}
|
||||||
m_EventBroker->Process<GUI::Frame>();
|
m_EventBroker->Process<GUI::Frame>();
|
||||||
m_FrameStack->UpdateLayered(dt);
|
m_FrameStack->UpdateLayered(dt);
|
||||||
@@ -610,17 +612,17 @@ private:
|
|||||||
m_GameIsRunning = true;
|
m_GameIsRunning = true;
|
||||||
//Todo: Move this
|
//Todo: Move this
|
||||||
{
|
{
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
m_EventBroker->Publish(e);
|
// m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/water-flowing.wav";
|
// e.FilePath = "Sounds/BGM/water-flowing.wav";
|
||||||
e.Gain = 0.3f;
|
// e.Gain = 0.3f;
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
m_EventBroker->Publish(e);
|
// m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ protected:
|
|||||||
Events::ButtonEnter e;
|
Events::ButtonEnter e;
|
||||||
e.FrameName = m_Name;
|
e.FrameName = m_Name;
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
Events::PlaySound soundEvent;
|
||||||
|
soundEvent.FilePath = "Sounds/GUI/hover.wav";
|
||||||
|
EventBroker->Publish(soundEvent);
|
||||||
|
|
||||||
} else if (!isOver && m_MouseIsOver) { // Leave
|
} else if (!isOver && m_MouseIsOver) { // Leave
|
||||||
if (!m_IsDown) {
|
if (!m_IsDown) {
|
||||||
if (!m_TextureReleased.empty()) {
|
if (!m_TextureReleased.empty()) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GUI/EButtonRelease.h"
|
#include "GUI/EButtonRelease.h"
|
||||||
#include "GUI/ESliderUpdate.h"
|
#include "GUI/ESliderUpdate.h"
|
||||||
#include "Core/EMouseMove.h"
|
#include "Core/EMouseMove.h"
|
||||||
|
#include "Sound/EPlaySound.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,11 @@ private:
|
|||||||
if (event.Button == m_SliderButton) {
|
if (event.Button == m_SliderButton) {
|
||||||
m_IsGrabbed = true;
|
m_IsGrabbed = true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Events::PlaySound e;
|
||||||
|
e.FilePath = "Sounds/GUI/click.wav";
|
||||||
|
EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
if (m_Texture == nullptr) {
|
if (m_Texture == nullptr) {
|
||||||
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
|
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeToTexture();
|
SizeToTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ dd::Systems::SoundSystem::~SoundSystem()
|
|||||||
for (auto &bgm : m_BGMSourcesToBuffers) {
|
for (auto &bgm : m_BGMSourcesToBuffers) {
|
||||||
alSourceStop(bgm.first);
|
alSourceStop(bgm.first);
|
||||||
alDeleteSources(1, &bgm.first);
|
alDeleteSources(1, &bgm.first);
|
||||||
bgm.second->~Sound();
|
//bgm.second->~Sound();
|
||||||
}
|
}
|
||||||
for (auto &sfx : m_SFXSourcesToBuffers) {
|
for (auto &sfx : m_SFXSourcesToBuffers) {
|
||||||
alSourceStop(sfx.first);
|
alSourceStop(sfx.first);
|
||||||
alDeleteSources(1, &sfx.first);
|
alDeleteSources(1, &sfx.first);
|
||||||
sfx.second->~Sound();
|
//sfx.second->~Sound();
|
||||||
}
|
}
|
||||||
m_BGMSourcesToBuffers.clear();
|
m_BGMSourcesToBuffers.clear();
|
||||||
m_SFXSourcesToBuffers.clear();
|
m_SFXSourcesToBuffers.clear();
|
||||||
@@ -40,22 +40,20 @@ void dd::Systems::SoundSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound);
|
EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume);
|
EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume);
|
||||||
|
|
||||||
//Todo: Move this
|
// //Todo: Move this
|
||||||
{
|
// {
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
EventBroker->Publish(e);
|
// EventBroker->Publish(e);
|
||||||
}
|
// }
|
||||||
{
|
// {
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = "Sounds/BGM/water-flowing.wav";
|
// e.FilePath = "Sounds/BGM/water-flowing.wav";
|
||||||
e.Gain = 0.3f;
|
// e.Gain = 0.3f;
|
||||||
e.IsAmbient = true;
|
// e.IsAmbient = true;
|
||||||
EventBroker->Publish(e);
|
// EventBroker->Publish(e);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dd::Systems::SoundSystem::Update(double dt)
|
void dd::Systems::SoundSystem::Update(double dt)
|
||||||
@@ -88,7 +86,7 @@ ALuint dd::Systems::SoundSystem::CreateSource()
|
|||||||
bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event)
|
bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event)
|
||||||
{
|
{
|
||||||
//Loading and binding sound buffer to source
|
//Loading and binding sound buffer to source
|
||||||
Sound *sound = ResourceManager::Load<Sound>(event.FilePath);
|
Sound *sound = ResourceManager::Load<Sound>(event.FilePath);
|
||||||
if (sound == nullptr) {
|
if (sound == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -181,10 +179,10 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event)
|
|||||||
//Send play-sound event
|
//Send play-sound event
|
||||||
|
|
||||||
{
|
{
|
||||||
dd::Events::PlaySound e;
|
// dd::Events::PlaySound e;
|
||||||
e.FilePath = collisionSound->FilePath;
|
// e.FilePath = collisionSound->FilePath;
|
||||||
e.IsAmbient = false;
|
// e.IsAmbient = false;
|
||||||
EventBroker->Publish(e);
|
// EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user