diff --git a/assets b/assets index d013629..5357a0c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d013629690347939068dcf44726c08aa252a72ae +Subproject commit 5357a0c4e1020317bb8745a057d6da62ab6c6504 diff --git a/src/GUI/GameFrame.h b/src/GUI/GameFrame.h index 56d0391..1b520d9 100644 --- a/src/GUI/GameFrame.h +++ b/src/GUI/GameFrame.h @@ -41,10 +41,10 @@ public: m_FreeCamViewport = new Viewport(m_WorldFrame, "ViewportFreeCam", m_World); m_FreeCamViewport->Hide(); } - //m_WorldFrame->Hide(); - //m_MainMenuFrame = new MainMenuFrame(this, "MainMenu"); - + m_WorldFrame->Hide(); m_World->Initialize(); + + m_MainMenuFrame = new MainMenuFrame(this, "MainMenu"); } private: diff --git a/src/GUI/MainMenuFrame.h b/src/GUI/MainMenuFrame.h index ff43254..076d6f9 100644 --- a/src/GUI/MainMenuFrame.h +++ b/src/GUI/MainMenuFrame.h @@ -5,6 +5,7 @@ #include "GUI/HealthOverlay.h" #include "Events/GameStart.h" +#include "Events/PlayBGM.h" namespace GUI { @@ -27,6 +28,10 @@ public: m_TargetCoordinate = m_CurrentCoordinate; m_Buttons->X = m_CurrentCoordinate.x; m_Buttons->Y = m_CurrentCoordinate.y; + + Events::PlayBGM e; + e.Resource = "Sounds/BGM/DiesIrae.mp3"; + EventBroker->Publish(e); } void Update(double dt) override @@ -74,8 +79,11 @@ protected: if (m_CurrentSelection == 0) { Hide(); - Events::GameStart e; - EventBroker->Publish(e); + Events::GameStart e1; + EventBroker->Publish(e1); + Events::PlayBGM e2; + e2.Resource = "Sounds/BGM/FlightOfTheBumblebee.mp3"; + EventBroker->Publish(e2); } // Quit else if (m_CurrentSelection == 1) diff --git a/src/Systems/GameStateSystem.cpp b/src/Systems/GameStateSystem.cpp index ca17bd3..54b87b9 100644 --- a/src/Systems/GameStateSystem.cpp +++ b/src/Systems/GameStateSystem.cpp @@ -11,9 +11,12 @@ bool Systems::GameStateSystem::OnFlagCaptured(const Events::FlagCaptured &event) { m_InGame = false; - Events::GameOver e; - e.Winner = event.Player; - EventBroker->Publish(e); + Events::GameOver e1; + e1.Winner = event.Player; + EventBroker->Publish(e1); + Events::PlayBGM e2; + e2.Resource = "Sounds/BGM/WilliamTellOverture.mp3"; + EventBroker->Publish(e2); return true; } \ No newline at end of file diff --git a/src/Systems/GameStateSystem.h b/src/Systems/GameStateSystem.h index ac9d46e..d24f0a6 100644 --- a/src/Systems/GameStateSystem.h +++ b/src/Systems/GameStateSystem.h @@ -8,6 +8,7 @@ #include "Components/Player.h" #include "Events/FlagCaptured.h" #include "Events/GameOver.h" +#include "Events/PlayBGM.h" namespace Systems { diff --git a/src/Systems/SoundSystem.cpp b/src/Systems/SoundSystem.cpp index dbf5ff3..c60a36a 100755 --- a/src/Systems/SoundSystem.cpp +++ b/src/Systems/SoundSystem.cpp @@ -166,11 +166,15 @@ bool Systems::SoundSystem::PlaySFX(const Events::PlaySFX &event) bool Systems::SoundSystem::PlayBGM(const Events::PlayBGM &event) { - - FMOD_Channel_Stop(m_BGMChannel); + FMOD_RESULT result; + result = FMOD_Channel_Stop(m_BGMChannel); + if(result != FMOD_OK) + LOG_INFO("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); Sound* sound = ResourceManager->Load("Sound2D", event.Resource); - FMOD_System_PlaySound(m_System, FMOD_CHANNEL_FREE, *sound, false, &m_BGMChannel); + result = FMOD_System_PlaySound(m_System, FMOD_CHANNEL_FREE, *sound, false, &m_BGMChannel); + if(result != FMOD_OK) + LOG_INFO("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); FMOD_Channel_SetMode(m_BGMChannel, FMOD_LOOP_NORMAL); FMOD_Sound_SetLoopCount(*sound, -1);