diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 13:57:13 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 13:57:13 +0100 |
commit | 07adbf48e0781cd8c95983c1871a84b6160ee5bf (patch) | |
tree | e3a55673b20ebaa3baec6665c107c177bd59ff14 /src/crepe/Asset.h | |
parent | 01c09a196c3f3e5cefaa4119a95a1cdeb7b9c263 (diff) |
implement asset + more WIP audio system
Diffstat (limited to 'src/crepe/Asset.h')
-rw-r--r-- | src/crepe/Asset.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/crepe/Asset.h b/src/crepe/Asset.h index cb413f4..f6e6782 100644 --- a/src/crepe/Asset.h +++ b/src/crepe/Asset.h @@ -1,7 +1,5 @@ #pragma once -#include <fstream> -#include <iostream> #include <string> namespace crepe { @@ -9,8 +7,8 @@ namespace crepe { /** * \brief Asset location helper * - * This class is used to locate and canonicalize paths to game asset files, and - * should *always* be used when retrieving files from disk. + * This class is used to locate game asset files, and should *always* be used + * instead of reading file paths directly. */ class Asset { public: @@ -18,24 +16,28 @@ public: * \param src Unique identifier to asset */ Asset(const std::string & src); - -public: /** - * \brief Get an input stream to the contents of this asset - * \return Input stream with file contents + * \param src Unique identifier to asset */ - std::istream & get_stream(); + Asset(const char * src); + +public: /** - * \brief Get the canonical path to this asset - * \return Canonical path to this asset + * \brief Get the path to this asset + * \return path to this asset */ - const std::string & get_canonical() const; + const std::string & get_path() const noexcept; private: - //! Canonical path to asset + //! path to asset const std::string src; - //! File handle (stream) - std::ifstream file; + +private: + std::string find_asset(const std::string & src) const; + /** + * \returns The path to the current executable + */ + std::string whereami() const noexcept; }; } // namespace crepe |