Started implementation of events for InputSystem and SoundSystem

This commit is contained in:
2014-04-28 19:55:31 +02:00
parent 5870a4d7bf
commit 57d29d0db7
25 changed files with 201 additions and 71 deletions
+27
View File
@@ -2,3 +2,30 @@
#include "DebugSystem.h"
#include "World.h"
void Systems::DebugSystem::Initialize()
{
// Subscribe to events
m_EKeyDown = decltype(m_EKeyDown)(std::bind(&Systems::DebugSystem::OnKeyDown, this, std::placeholders::_1));
EventBroker->Subscribe(m_EKeyDown);
}
void Systems::DebugSystem::Update(double dt)
{
}
bool Systems::DebugSystem::OnKeyDown(const Events::KeyDown &event)
{
if (event.KeyCode == GLFW_KEY_ENTER)
{
Events::PlaySound e;
e.Emitter = 0;
e.Resource = "Sounds/korvring.wav";
EventBroker->Publish<Events::PlaySound>(e);
return true;
}
return false;
}