|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Abstract interface for loading raw asset data by path. More...
#include <flint/core/asset-loader.h>
Inheritance diagram for Flint::IAssetLoader:
Collaboration diagram for Flint::IAssetLoader:Public Member Functions | |
| virtual std::vector< char > | getAsset (const std::string &path)=0 |
Load the asset at path and return its raw bytes. | |
| virtual bool | hasAsset (const std::string &path) const =0 |
| Check whether an asset exists without loading it. | |
| virtual bool | isDoneLoading () const =0 |
| Query whether all assets have finished loading. | |
| virtual uint64_t | getAssetRevision (const std::string &path) const =0 |
Return an opaque token that changes when path's contents change. | |
Abstract interface for loading raw asset data by path.
Implementations might load from disk, a ZIP archive, or an in-memory store. The engine calls getAsset() to obtain byte blobs that are then handed to texture loaders, shader compilers, and so on.
Definition at line 18 of file asset-loader.h.
|
pure virtual |
Load the asset at path and return its raw bytes.
| path | Asset path, relative to the loader's root. |
| Implementation-defined | exception if the asset cannot be found or read. |
Implemented in Flint::FileSystem.
|
pure virtual |
Return an opaque token that changes when path's contents change.
Only meaningful for equality comparison against a previously returned value for the same path. Not a timestamp, not ordered, not a counter.
Zero is reserved to mean "no such asset". Implementations must return 0 for any path that is absent or unreadable, and must never return 0 for an asset that getAsset() could successfully load. A loader that cannot track changes should still return a stable nonzero value for assets it has — returning 0 marks them permanently missing and disables hot reload.
| path | Asset path to query. |
Implemented in Flint::FileSystem.
|
pure virtual |
Check whether an asset exists without loading it.
| path | Asset path to test. |
Implemented in Flint::FileSystem.
|
pure virtual |
Query whether all assets have finished loading.
For synchronous loaders this always returns true. Async loaders may return false while background loading is in progress.
Implemented in Flint::FileSystem.