Merge remote-tracking branch 'origin/master' into Physics
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
This file is part of Daydream Engine.
|
||||
Copyright 2014 Adam Byléhn, Tobias Dahl, Simon Holmberg, Viktor Ljung
|
||||
|
||||
Daydream Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Daydream Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Daydream Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef Events_PlaySFX_h__
|
||||
#define Events_PlaySFX_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct PlaySFX : Event
|
||||
{
|
||||
std::string path;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // Events_PlaySFX_h__
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef Events_PlaySFX_h__
|
||||
#define Events_PlaySFX_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct PlaySound : Event
|
||||
{
|
||||
std::string path;
|
||||
float volume = 1.f;
|
||||
float pitch = 1.f;
|
||||
bool loop = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef EVENTS_ESTOPSOUND_H__
|
||||
#define EVENTS_ESTOPSOUND_H__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct StopSound : public Event
|
||||
{
|
||||
std::string path;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@ class Sound : public Resource
|
||||
friend class ResourceManager;
|
||||
public:
|
||||
ALuint Buffer() { return m_Buffer; };
|
||||
std::string Path() { return m_Path; };
|
||||
private:
|
||||
Sound(std::string path);
|
||||
|
||||
@@ -28,6 +29,7 @@ private:
|
||||
ALuint LoadFile(std::string path);
|
||||
|
||||
ALuint m_Buffer;
|
||||
std::string m_Path;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
#include "AL/alc.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/World.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound/EPlaySFX.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
#include "Sound/EStopSound.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CPad.h"
|
||||
@@ -34,17 +35,20 @@ public:
|
||||
|
||||
private:
|
||||
//Events
|
||||
dd::EventRelay<SoundSystem, dd::Events::PlaySFX> m_EPlaySFX;
|
||||
dd::EventRelay<SoundSystem, dd::Events::PlaySound> m_EPlaySFX;
|
||||
dd::EventRelay<SoundSystem, dd::Events::Contact> m_EContact;
|
||||
bool OnPlaySFX(const dd::Events::PlaySFX &event);
|
||||
dd::EventRelay<SoundSystem, dd::Events::StopSound> m_EStopSound;
|
||||
bool OnPlaySound(const dd::Events::PlaySound &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnStopSound(const dd::Events::StopSound &event);
|
||||
|
||||
ALuint CreateSource();
|
||||
|
||||
std::map<Component*, ALuint> m_Sources;
|
||||
std::map<ALuint, Sound*> m_SourcesToBuffers;
|
||||
|
||||
ALCdevice* m_Device;
|
||||
|
||||
//std::list<ALuint>
|
||||
//Temp
|
||||
ALuint m_Source;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user