Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef SoundEmitter_h__
|
||||
#define SoundEmitter_h__
|
||||
|
||||
#include "AL/al.h"
|
||||
#include "AL/alc.h"
|
||||
|
||||
#include "System.h"
|
||||
#include "Components/SoundEmitter.h"
|
||||
|
||||
namespace Systems
|
||||
{
|
||||
|
||||
class SoundSystem : public System
|
||||
{
|
||||
public:
|
||||
SoundSystem(World* world);
|
||||
|
||||
void Update(double dt) override;
|
||||
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||
void OnComponentCreated(std::string type, std::shared_ptr<Component> component) override;
|
||||
void PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName);
|
||||
void LoadFile(std::string fileName);
|
||||
private:
|
||||
ALCcontext* context;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // !SoundEmitter_h__
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "SoundSystem.h"
|
||||
#include "World.h"
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
Systems::SoundSystem::SoundSystem(World* world)
|
||||
: System(world)
|
||||
{
|
||||
ALCdevice* Device = alcOpenDevice(nullptr);
|
||||
|
||||
if(Device)
|
||||
{
|
||||
context = alcCreateContext(Device, nullptr);
|
||||
alcMakeContextCurrent(context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Systems::SoundSystem::Update(double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
{
|
||||
auto soundEmitter = m_World->GetComponent<Components::SoundEmitter>(entity, "SoundEmitter");
|
||||
if(soundEmitter == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Systems::SoundSystem::PlaySound(std::shared_ptr<Components::SoundEmitter> emitter, std::string fileName)
|
||||
{
|
||||
LoadFile(fileName);
|
||||
}
|
||||
|
||||
void Systems::SoundSystem::LoadFile(std::string fileName)
|
||||
{
|
||||
//loadWavFile()
|
||||
}
|
||||
Reference in New Issue
Block a user