Added comments and cleaned up in Game.cpp/h
This commit is contained in:
+2
-6
@@ -29,10 +29,6 @@
|
||||
|
||||
// Sound
|
||||
#include "Sound/SoundSystem.h"
|
||||
//#include "Sound/EPlaySound.h"
|
||||
//#include "Sound/EPlaySoundOnEntity.h"
|
||||
//#include "Sound/EPlaySoundOnPosition.h"
|
||||
|
||||
|
||||
class Game
|
||||
{
|
||||
@@ -65,8 +61,8 @@ private:
|
||||
// Sound
|
||||
SoundSystem* m_SoundSystem;
|
||||
|
||||
EventRelay<Game, Events::InputCommand> m_EInputCommand;
|
||||
bool debugOnInputCommand(const Events::InputCommand& e);
|
||||
//EventRelay<Game, Events::InputCommand> m_EInputCommand;
|
||||
//bool debugOnInputCommand(const Events::InputCommand& e);
|
||||
|
||||
void debugInitialize();
|
||||
void debugTick(double dt);
|
||||
|
||||
@@ -49,6 +49,7 @@ void SoundSystem::stopEmitters()
|
||||
|
||||
void SoundSystem::Update()
|
||||
{
|
||||
m_EventBroker->Process<SoundSystem>();
|
||||
addNewEmitters(); // can be optimized with "EEntityCreated"
|
||||
deleteInactiveEmitters(); // can be optimized with "EEntityDeleted"
|
||||
updateEmitters();
|
||||
@@ -66,14 +67,14 @@ void SoundSystem::deleteInactiveEmitters()
|
||||
it++;
|
||||
continue;
|
||||
} else {
|
||||
// Sound has been stopped / finished playing. And has correct component.
|
||||
// Sound has been stopped / finished playing.
|
||||
alDeleteBuffers(1, &it->second->ALsource);
|
||||
alDeleteSources(1, &it->second->ALsource);
|
||||
m_World->DeleteEntity(it->first);
|
||||
it = m_Sources.erase(it);
|
||||
}
|
||||
} else {
|
||||
// Entity has been removed
|
||||
// Entity / Component has been removed
|
||||
stopSound((*it).second);
|
||||
alDeleteBuffers(1, &it->second->ALsource);
|
||||
alDeleteSources(1, &it->second->ALsource);
|
||||
@@ -251,6 +252,7 @@ bool SoundSystem::OnSetSFXGain(const Events::SetSFXGain & e)
|
||||
|
||||
void SoundSystem::setListenerOri(glm::vec3 ori)
|
||||
{
|
||||
// Calculate forward and up vector.
|
||||
glm::vec3 forward = glm::vec3(0.0, 0.0, -1.0);
|
||||
forward = glm::rotateX(forward, ori.x);
|
||||
forward = glm::rotateY(forward, ori.y);
|
||||
|
||||
+3
-7
@@ -77,7 +77,8 @@ Game::Game(int argc, char* argv[])
|
||||
//boost::thread workerThread(&Game::networkFunction, this);
|
||||
networkFunction();
|
||||
}
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Game::debugOnInputCommand);
|
||||
|
||||
// Invoke sound system
|
||||
m_SoundSystem = new SoundSystem(m_World, m_EventBroker, m_Config->Get<bool>("Debug.EditorEnabled", false));
|
||||
|
||||
m_LastTime = glfwGetTime();
|
||||
@@ -86,6 +87,7 @@ Game::Game(int argc, char* argv[])
|
||||
Game::~Game()
|
||||
{
|
||||
delete m_SystemPipeline;
|
||||
delete m_SoundSystem;
|
||||
delete m_World;
|
||||
delete m_FrameStack;
|
||||
delete m_InputProxy;
|
||||
@@ -122,7 +124,6 @@ void Game::Tick()
|
||||
debugTick(dt);
|
||||
m_Renderer->Update(dt);
|
||||
m_EventBroker->Process<Client>();
|
||||
m_EventBroker->Process<SoundSystem>();
|
||||
m_SoundSystem->Update();
|
||||
m_RenderQueueFactory->Update(m_World);
|
||||
GLERROR("Game::Tick m_RenderQueueFactory->Update");
|
||||
@@ -132,11 +133,6 @@ void Game::Tick()
|
||||
m_EventBroker->Clear();
|
||||
}
|
||||
|
||||
bool Game::debugOnInputCommand(const Events::InputCommand & e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Game::debugTick(double dt)
|
||||
{
|
||||
m_EventBroker->Process<Game>();
|
||||
|
||||
Reference in New Issue
Block a user