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
+16
View File
@@ -16,6 +16,22 @@ void Systems::InputSystem::Update(double dt)
for (int i = 0; i <= GLFW_KEY_LAST; ++i)
{
m_CurrentKeyState[i] = glfwGetKey(m_Renderer->GetWindow(), i);
if (m_CurrentKeyState[i] != m_LastKeyState[i])
{
// Publish key events
if (m_CurrentKeyState[i])
{
Events::KeyDown e;
e.KeyCode = i;
EventBroker->Publish<Events::KeyDown>(e);
}
else
{
Events::KeyUp e;
e.KeyCode = i;
EventBroker->Publish<Events::KeyUp>(e);
}
}
}
// Mouse buttons