aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/AudioSource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/AudioSource.cpp')
-rw-r--r--src/crepe/api/AudioSource.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp
new file mode 100644
index 0000000..b0cf28c
--- /dev/null
+++ b/src/crepe/api/AudioSource.cpp
@@ -0,0 +1,22 @@
+#include <memory>
+
+#include "AudioSource.h"
+
+using namespace crepe;
+using namespace std;
+
+AudioSource::AudioSource(game_object_id_t id, unique_ptr<Asset> audio_clip) :
+ Component(id),
+ audio_clip(std::move(audio_clip))
+{ }
+
+void AudioSource::play(bool looping) {
+ this->loop = looping;
+ this->playing = true;
+}
+
+void AudioSource::stop() {
+ this->playing = false;
+ this->rewind = true;
+}
+