Added Component to bricks to emitt sound. Improved code for playing a sound

This commit is contained in:
Stiffly
2015-09-17 15:41:08 +02:00
parent 6671136a08
commit 4dd8ac8445
9 changed files with 55 additions and 5 deletions
+3
View File
@@ -18,6 +18,7 @@
#include <string>
#include <sstream>
#include <Sound/CCollisionSound.h>
#include "ResourceManager.h"
#include "OBJ.h"
@@ -37,6 +38,7 @@
#include "Rendering/CPointLight.h"
#include "Transform/TransformSystem.h"
#include "Sound/SoundSystem.h"
#include "Sound/CCollisionSound.h"
#include "Game/LevelSystem.h"
#include "Game/PadSystem.h"
#include "Game/CBall.h"
@@ -76,6 +78,7 @@ public:
m_World->ComponentFactory.Register<Components::Model>();
m_World->ComponentFactory.Register<Components::Template>();
m_World->ComponentFactory.Register<Components::CollisionSound>();
m_World->SystemFactory.Register<Systems::SoundSystem>([this]() { return new Systems::SoundSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::SoundSystem>();
+1
View File
@@ -23,6 +23,7 @@
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
#include "Physics/EContact.h"
#include "Sound/CCollisionSound.h"
#include <fstream>
#include <iostream>
#include <intrin.h>
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adam on 2015-09-17.
//
#ifndef COMPONENTS_CCOLLISIONSOUND_H__
#define COMPONENTS_CCOLLISIONSOUND_H__
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct CollisionSound : public Component
{
std::string filePath;
};
}
}
#endif
+5 -3
View File
@@ -28,9 +28,11 @@
#include "Sound/EPlaySFX.h"
#include "Physics/EContact.h"
#include "Core/EventBroker.h"
#include <Game/CBall.h>
#include <Game/CBrick.h>
#include <Game/CPad.h>
#include "Game/CBall.h"
#include "Game/CBrick.h"
#include "Game/CPad.h"
#include "Sound/CCollisionSound.h"
namespace dd
{