Added sound files. Listens to collision events -> play sound.
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
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 DAYDREAM_EPLAYSOUND_H
|
||||
#define DAYDREAM_EPLAYSOUND_H
|
||||
#ifndef Events_PlaySFX_h__
|
||||
#define Events_PlaySFX_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
@@ -27,14 +27,13 @@ namespace dd
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct PlaySound : Event
|
||||
struct PlaySFX : Event
|
||||
{
|
||||
float volume;
|
||||
std::string path;
|
||||
std::string path;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_EPLAYSOUND_H
|
||||
#endif // Events_PlaySFX_h__
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// Created by Adam on 2015-09-09.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_EPLAYSOUND_H
|
||||
#define DAYDREAM_EPLAYSOUND_H
|
||||
|
||||
#include <string>
|
||||
#include "EventBroker.h"
|
||||
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct PlaySound
|
||||
{
|
||||
std::string path;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_EPLAYSOUND_H
|
||||
@@ -25,7 +25,8 @@
|
||||
#include "Core/System.h"
|
||||
#include "Core/World.h"
|
||||
#include "Core/EKeyDown.h"
|
||||
#include "Core/EPlaySound.h"
|
||||
#include "Core/EPlaySFX.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
@@ -53,10 +54,12 @@ public:
|
||||
private:
|
||||
//Events
|
||||
dd::EventRelay<Sound, dd::Events::KeyDown> m_EKeyDown;
|
||||
bool OnKeyDown(const dd::Events::KeyDown &event);
|
||||
dd::EventRelay<Sound, dd::Events::PlaySFX> m_EPlaySFX;
|
||||
dd::EventRelay<Sound, dd::Events::Contact> m_EContact;
|
||||
|
||||
//dd::EventRelay<Sound, dd::Events::PlaySound> m_EPlaySound;
|
||||
//bool PlayASound(const dd::Events::PlaySound &event);
|
||||
bool OnKeyDown(const dd::Events::KeyDown &event);
|
||||
bool OnPlaySFX(const dd::Events::PlaySFX &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
|
||||
ALuint LoadFile(std::string fileName);
|
||||
ALuint CreateSource();
|
||||
|
||||
Reference in New Issue
Block a user