Added some extra functions for managing assets.

This commit is contained in:
2023-12-06 08:59:19 -06:00
parent 0b61be734d
commit 3c31c2872d
3 changed files with 30 additions and 0 deletions

View File

@ -50,6 +50,16 @@ void AssetManager::removeExisting(const std::string filename) {
}
}
bool_t AssetManager::isEverythingLoaded() {
return pendingAssetLoaders.size() == 0;
}
bool_t AssetManager::isLoaded(const std::string filename) {
auto existing = this->getExisting<AssetLoader>(filename);
if(existing) return existing->loaded;
return false;
}
template<>
std::shared_ptr<Texture> AssetManager::get<Texture>(
const std::string filename

View File

@ -60,6 +60,22 @@ namespace Dawn {
*/
void update();
/**
* Returns whether the asset manager has loaded all of the currently
* managed assets.
*
* @return True if all assets have been loaded.
*/
bool_t isEverythingLoaded();
/**
* Returns whether the asset manager has loaded the given asset.
*
* @param filename The filename of the asset to check.
* @return True if the asset has been loaded.
*/
bool_t isLoaded(const std::string filename);
/**
* Returns the asset loader for the given asset.
*