diff options
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Asset.cpp | 14 | ||||
-rw-r--r-- | src/crepe/api/Asset.h (renamed from src/crepe/api/Resource.h) | 4 | ||||
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 2 | ||||
-rw-r--r-- | src/crepe/api/AudioSource.h | 6 | ||||
-rw-r--r-- | src/crepe/api/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/crepe/api/Resource.cpp | 14 |
6 files changed, 22 insertions, 22 deletions
diff --git a/src/crepe/api/Asset.cpp b/src/crepe/api/Asset.cpp new file mode 100644 index 0000000..92ee50e --- /dev/null +++ b/src/crepe/api/Asset.cpp @@ -0,0 +1,14 @@ +#include <filesystem> + +#include "Asset.h" + +using namespace crepe::api; + +Asset::Asset(const std::string & src) { + this->src = std::filesystem::canonical(src); + this->file = std::ifstream(this->src, std::ios::in | std::ios::binary); +} + +const std::istream & Asset::read() { return this->file; } + +const char * Asset::canonical() { return this->src.c_str(); } diff --git a/src/crepe/api/Resource.h b/src/crepe/api/Asset.h index f2b2a0e..259c696 100644 --- a/src/crepe/api/Resource.h +++ b/src/crepe/api/Asset.h @@ -6,9 +6,9 @@ namespace crepe::api { -class Resource { +class Asset { public: - Resource(const std::string & src); + Asset(const std::string & src); public: //! Get an input stream to the contents of this resource diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp index 4d1b093..656fc46 100644 --- a/src/crepe/api/AudioSource.cpp +++ b/src/crepe/api/AudioSource.cpp @@ -5,7 +5,7 @@ using namespace crepe::api; -AudioSource::AudioSource(std::unique_ptr<Resource> audio_clip) { +AudioSource::AudioSource(std::unique_ptr<Asset> audio_clip) { this->_sound = std::make_unique<crepe::Sound>(std::move(audio_clip)); } diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h index 4300c48..9dfaf46 100644 --- a/src/crepe/api/AudioSource.h +++ b/src/crepe/api/AudioSource.h @@ -3,7 +3,7 @@ #include <memory> #include "Component.h" -#include "Resource.h" +#include "Asset.h" namespace crepe { class Sound; @@ -14,7 +14,7 @@ namespace crepe::api { //! Audio source component class AudioSource : Component { public: - AudioSource(std::unique_ptr<Resource> audio_clip); + AudioSource(std::unique_ptr<Asset> audio_clip); virtual ~AudioSource() = default; public: @@ -26,7 +26,7 @@ public: public: //! Sample file location - std::unique_ptr<Resource> audio_clip; + std::unique_ptr<Asset> audio_clip; //! TODO: ????? bool play_on_awake; //! Repeat the current audio clip during playback diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index feb03ef..54c7fdc 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -1,11 +1,11 @@ target_sources(crepe PUBLIC # AudioSource.cpp - Resource.cpp + Asset.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES AudioSource.h Component.h - Resource.h + Asset.h ) diff --git a/src/crepe/api/Resource.cpp b/src/crepe/api/Resource.cpp deleted file mode 100644 index 1a647ce..0000000 --- a/src/crepe/api/Resource.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include <filesystem> - -#include "Resource.h" - -using namespace crepe::api; - -Resource::Resource(const std::string & src) { - this->src = std::filesystem::canonical(src); - this->file = std::ifstream(this->src, std::ios::in | std::ios::binary); -} - -const std::istream & Resource::read() { return this->file; } - -const char * Resource::canonical() { return this->src.c_str(); } |