Audio API first pass

This commit is contained in:
2023-01-17 10:13:08 -08:00
parent 2950bc9184
commit 9168348e6b
27 changed files with 513 additions and 95 deletions

View File

@ -8,6 +8,9 @@
#include "scenes/Scene_2.hpp"
#include "prefabs/characters/DeathPrefab.hpp"
#include "scene/components/audio/AudioListener.hpp"
#include "scene/components/audio/AudioSource.hpp"
namespace Dawn {
class Scene_1 : public PixelVNScene {
protected:
@ -18,6 +21,19 @@ namespace Dawn {
this->death = DeathPrefab::create(this);
// this->death->vnCharacter.setOpacity(0);
auto listenerItem = this->createSceneItem();
auto listener = listenerItem->addComponent<AudioListener>();
auto sourceItem = this->createSceneItem();
auto source = sourceItem->addComponent<AudioSource>();
source->transform->setLocalPosition(glm::vec3(-1, 0, 0));
auto data = new AudioData();
data->init();
source->setAudioData(data);
source->play();
}
void onSceneEnded() {