This commit is contained in:
Stiffly
2015-10-15 13:48:05 +02:00
parent bb23d5a8c4
commit 64f903a6b6
5 changed files with 43 additions and 32 deletions
+11 -9
View File
@@ -391,6 +391,8 @@ public:
// I apologize about this.
ScreenShakeUpdate(dt);
} else {
m_EventBroker->Process<Systems::SoundSystem>();
}
m_EventBroker->Process<GUI::Frame>();
m_FrameStack->UpdateLayered(dt);
@@ -610,17 +612,17 @@ private:
m_GameIsRunning = true;
//Todo: Move this
{
dd::Events::PlaySound e;
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
e.IsAmbient = true;
m_EventBroker->Publish(e);
// dd::Events::PlaySound e;
// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
// e.IsAmbient = true;
// m_EventBroker->Publish(e);
}
{
dd::Events::PlaySound e;
e.FilePath = "Sounds/BGM/water-flowing.wav";
e.Gain = 0.3f;
e.IsAmbient = true;
m_EventBroker->Publish(e);
// dd::Events::PlaySound e;
// e.FilePath = "Sounds/BGM/water-flowing.wav";
// e.Gain = 0.3f;
// e.IsAmbient = true;
// m_EventBroker->Publish(e);
}
return true;
+4
View File
@@ -75,6 +75,10 @@ protected:
Events::ButtonEnter e;
e.FrameName = m_Name;
EventBroker->Publish(e);
Events::PlaySound soundEvent;
soundEvent.FilePath = "Sounds/GUI/hover.wav";
EventBroker->Publish(soundEvent);
} else if (!isOver && m_MouseIsOver) { // Leave
if (!m_IsDown) {
if (!m_TextureReleased.empty()) {
+6
View File
@@ -7,6 +7,7 @@
#include "GUI/EButtonRelease.h"
#include "GUI/ESliderUpdate.h"
#include "Core/EMouseMove.h"
#include "Sound/EPlaySound.h"
namespace dd
{
@@ -79,6 +80,11 @@ private:
if (event.Button == m_SliderButton) {
m_IsGrabbed = true;
}
else {
Events::PlaySound e;
e.FilePath = "Sounds/GUI/click.wav";
EventBroker->Publish(e);
}
return true;
}
+1
View File
@@ -62,6 +62,7 @@ public:
if (m_Texture == nullptr) {
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
}
SizeToTexture();
}
+21 -23
View File
@@ -6,12 +6,12 @@ dd::Systems::SoundSystem::~SoundSystem()
for (auto &bgm : m_BGMSourcesToBuffers) {
alSourceStop(bgm.first);
alDeleteSources(1, &bgm.first);
bgm.second->~Sound();
//bgm.second->~Sound();
}
for (auto &sfx : m_SFXSourcesToBuffers) {
alSourceStop(sfx.first);
alDeleteSources(1, &sfx.first);
sfx.second->~Sound();
//sfx.second->~Sound();
}
m_BGMSourcesToBuffers.clear();
m_SFXSourcesToBuffers.clear();
@@ -40,22 +40,20 @@ void dd::Systems::SoundSystem::Initialize()
EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound);
EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume);
//Todo: Move this
{
dd::Events::PlaySound e;
e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
e.IsAmbient = true;
EventBroker->Publish(e);
}
{
dd::Events::PlaySound e;
e.FilePath = "Sounds/BGM/water-flowing.wav";
e.Gain = 0.3f;
e.IsAmbient = true;
EventBroker->Publish(e);
}
// //Todo: Move this
// {
// dd::Events::PlaySound e;
// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav";
// e.IsAmbient = true;
// EventBroker->Publish(e);
// }
// {
// dd::Events::PlaySound e;
// e.FilePath = "Sounds/BGM/water-flowing.wav";
// e.Gain = 0.3f;
// e.IsAmbient = true;
// EventBroker->Publish(e);
// }
}
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)
{
//Loading and binding sound buffer to source
Sound *sound = ResourceManager::Load<Sound>(event.FilePath);
Sound *sound = ResourceManager::Load<Sound>(event.FilePath);
if (sound == nullptr) {
return false;
}
@@ -181,10 +179,10 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event)
//Send play-sound event
{
dd::Events::PlaySound e;
e.FilePath = collisionSound->FilePath;
e.IsAmbient = false;
EventBroker->Publish(e);
// dd::Events::PlaySound e;
// e.FilePath = collisionSound->FilePath;
// e.IsAmbient = false;
// EventBroker->Publish(e);
}
return true;